blob: 9241357e65343217bb64770273eabbd7297a2232 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3% %
4% %
5% %
6% RRRR GGGG BBBB %
7% R R G B B %
8% RRRR G GG BBBB %
9% R R G G B B %
10% R R GGG BBBB %
11% %
12% %
13% Read/Write Raw RGB Image Format %
14% %
15% Software Design %
16% John Cristy %
17% July 1992 %
18% %
19% %
20% Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization %
21% dedicated to making software imaging solutions freely available. %
22% %
23% You may not use this file except in compliance with the License. You may %
24% obtain a copy of the License at %
25% %
26% http://www.imagemagick.org/script/license.php %
27% %
28% Unless required by applicable law or agreed to in writing, software %
29% distributed under the License is distributed on an "AS IS" BASIS, %
30% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31% See the License for the specific language governing permissions and %
32% limitations under the License. %
33% %
34%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35%
36%
37*/
38
39/*
40 Include declarations.
41*/
cristy4c08aed2011-07-01 19:47:50 +000042#include "MagickCore/studio.h"
43#include "MagickCore/blob.h"
44#include "MagickCore/blob-private.h"
45#include "MagickCore/cache.h"
46#include "MagickCore/colorspace.h"
cristy510d06a2011-07-06 23:43:54 +000047#include "MagickCore/colorspace-private.h"
cristy4c08aed2011-07-01 19:47:50 +000048#include "MagickCore/constitute.h"
49#include "MagickCore/exception.h"
50#include "MagickCore/exception-private.h"
51#include "MagickCore/image.h"
52#include "MagickCore/image-private.h"
53#include "MagickCore/list.h"
54#include "MagickCore/magick.h"
55#include "MagickCore/memory_.h"
56#include "MagickCore/monitor.h"
57#include "MagickCore/monitor-private.h"
58#include "MagickCore/pixel-accessor.h"
59#include "MagickCore/quantum-private.h"
60#include "MagickCore/static.h"
61#include "MagickCore/statistic.h"
62#include "MagickCore/string_.h"
63#include "MagickCore/module.h"
64#include "MagickCore/utility.h"
cristy3ed852e2009-09-05 21:47:34 +000065
66/*
67 Forward declarations.
68*/
69static MagickBooleanType
cristy3a37efd2011-08-28 20:31:03 +000070 WriteRGBImage(const ImageInfo *,Image *,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +000071
72/*
73%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74% %
75% %
76% %
77% R e a d R G B I m a g e %
78% %
79% %
80% %
81%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82%
cristy90dbac72010-08-22 15:08:40 +000083% ReadRGBImage() reads an image of raw RGB, RGBA, or RGBO samples and returns
84% it. It allocates the memory necessary for the new Image structure and
85% returns a pointer to the new image.
cristy3ed852e2009-09-05 21:47:34 +000086%
87% The format of the ReadRGBImage method is:
88%
cristy90dbac72010-08-22 15:08:40 +000089% Image *ReadRGBImage(const ImageInfo *image_info,
90% ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +000091%
92% A description of each parameter follows:
93%
94% o image_info: the image info.
95%
96% o exception: return any errors or warnings in this structure.
97%
98*/
cristyddacdd12012-05-07 23:08:14 +000099static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000100{
101 Image
102 *canvas_image,
103 *image;
104
cristy3ed852e2009-09-05 21:47:34 +0000105 MagickBooleanType
106 status;
107
108 MagickOffsetType
109 scene;
110
111 QuantumInfo
112 *quantum_info;
113
114 QuantumType
115 quantum_type;
116
cristybb503372010-05-27 20:51:26 +0000117 register ssize_t
cristy90dbac72010-08-22 15:08:40 +0000118 i;
cristy3ed852e2009-09-05 21:47:34 +0000119
cristyc6da28e2011-04-28 01:41:35 +0000120 size_t
121 length;
122
cristy3ed852e2009-09-05 21:47:34 +0000123 ssize_t
cristya38675f2010-08-21 18:35:13 +0000124 count,
125 y;
cristy3ed852e2009-09-05 21:47:34 +0000126
cristy3ed852e2009-09-05 21:47:34 +0000127 unsigned char
128 *pixels;
129
cristy3ed852e2009-09-05 21:47:34 +0000130 /*
131 Open image file.
132 */
133 assert(image_info != (const ImageInfo *) NULL);
134 assert(image_info->signature == MagickSignature);
135 if (image_info->debug != MagickFalse)
136 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
137 image_info->filename);
138 assert(exception != (ExceptionInfo *) NULL);
139 assert(exception->signature == MagickSignature);
cristy9950d572011-10-01 18:22:35 +0000140 image=AcquireImage(image_info,exception);
cristy3ed852e2009-09-05 21:47:34 +0000141 if ((image->columns == 0) || (image->rows == 0))
142 ThrowReaderException(OptionError,"MustSpecifyImageSize");
cristye2c4f182012-05-12 14:11:53 +0000143 SetImageColorspace(image,sRGBColorspace,exception);
cristy3ed852e2009-09-05 21:47:34 +0000144 if (image_info->interlace != PartitionInterlace)
145 {
146 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
147 if (status == MagickFalse)
148 {
149 image=DestroyImageList(image);
150 return((Image *) NULL);
151 }
cristyd4297022010-09-16 22:59:09 +0000152 if (DiscardBlobBytes(image,image->offset) == MagickFalse)
153 ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
154 image->filename);
cristy3ed852e2009-09-05 21:47:34 +0000155 }
156 /*
157 Create virtual canvas to support cropping (i.e. image.rgb[100x100+10+20]).
158 */
159 canvas_image=CloneImage(image,image->extract_info.width,1,MagickFalse,
160 exception);
cristy387430f2012-02-07 13:09:46 +0000161 (void) SetImageVirtualPixelMethod(canvas_image,BlackVirtualPixelMethod,
162 exception);
cristy3ed852e2009-09-05 21:47:34 +0000163 quantum_info=AcquireQuantumInfo(image_info,canvas_image);
164 if (quantum_info == (QuantumInfo *) NULL)
165 ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
166 pixels=GetQuantumPixels(quantum_info);
167 quantum_type=RGBQuantum;
cristy90dbac72010-08-22 15:08:40 +0000168 if (LocaleCompare(image_info->magick,"RGBA") == 0)
cristya38675f2010-08-21 18:35:13 +0000169 {
cristy90dbac72010-08-22 15:08:40 +0000170 quantum_type=RGBAQuantum;
171 image->matte=MagickTrue;
cristyc6aebff2012-05-07 23:24:35 +0000172 canvas_image->matte=MagickTrue;
cristya38675f2010-08-21 18:35:13 +0000173 }
cristy90dbac72010-08-22 15:08:40 +0000174 if (LocaleCompare(image_info->magick,"RGBO") == 0)
175 {
176 quantum_type=RGBOQuantum;
cristyc6aebff2012-05-07 23:24:35 +0000177 canvas_image->matte=MagickTrue;
cristy90dbac72010-08-22 15:08:40 +0000178 }
cristy3ed852e2009-09-05 21:47:34 +0000179 if (image_info->number_scenes != 0)
180 while (image->scene < image_info->scene)
181 {
182 /*
183 Skip to next image.
184 */
185 image->scene++;
186 length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
cristybb503372010-05-27 20:51:26 +0000187 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +0000188 {
189 count=ReadBlob(image,length,pixels);
190 if (count != (ssize_t) length)
191 break;
192 }
193 }
cristy3ed852e2009-09-05 21:47:34 +0000194 count=0;
195 length=0;
196 scene=0;
197 do
198 {
199 /*
200 Read pixels to virtual canvas image then push to image.
201 */
202 if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
203 if (image->scene >= (image_info->scene+image_info->number_scenes-1))
204 break;
cristye2c4f182012-05-12 14:11:53 +0000205 SetImageColorspace(image,sRGBColorspace,exception);
cristy3ed852e2009-09-05 21:47:34 +0000206 switch (image_info->interlace)
207 {
208 case NoInterlace:
209 default:
210 {
211 /*
212 No interlacing: RGBRGBRGBRGBRGBRGB...
213 */
214 if (scene == 0)
215 {
216 length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
217 count=ReadBlob(image,length,pixels);
cristy3ed852e2009-09-05 21:47:34 +0000218 }
cristybb503372010-05-27 20:51:26 +0000219 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000220 {
cristy4c08aed2011-07-01 19:47:50 +0000221 register const Quantum
cristyc47d1f82009-11-26 01:44:43 +0000222 *restrict p;
cristy3ed852e2009-09-05 21:47:34 +0000223
cristy4c08aed2011-07-01 19:47:50 +0000224 register Quantum
cristyc47d1f82009-11-26 01:44:43 +0000225 *restrict q;
cristy3ed852e2009-09-05 21:47:34 +0000226
cristy90dbac72010-08-22 15:08:40 +0000227 register ssize_t
228 x;
229
cristy21da32d2009-09-12 14:56:09 +0000230 if (count != (ssize_t) length)
231 {
232 ThrowFileException(exception,CorruptImageError,
233 "UnexpectedEndOfFile",image->filename);
234 break;
235 }
cristy3ed852e2009-09-05 21:47:34 +0000236 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
237 exception);
cristyacd2ed22011-08-30 01:44:23 +0000238 if (q == (Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000239 break;
240 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
241 quantum_info,quantum_type,pixels,exception);
242 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
243 break;
cristy90dbac72010-08-22 15:08:40 +0000244 if (((y-image->extract_info.y) >= 0) &&
cristybb503372010-05-27 20:51:26 +0000245 ((y-image->extract_info.y) < (ssize_t) image->rows))
cristy3ed852e2009-09-05 21:47:34 +0000246 {
247 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
248 canvas_image->columns,1,exception);
249 q=QueueAuthenticPixels(image,0,y-image->extract_info.y,
250 image->columns,1,exception);
cristyddacdd12012-05-07 23:08:14 +0000251 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000252 break;
cristybb503372010-05-27 20:51:26 +0000253 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000254 {
cristy4c08aed2011-07-01 19:47:50 +0000255 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
256 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
257 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
258 SetPixelAlpha(image,OpaqueAlpha,q);
cristy90dbac72010-08-22 15:08:40 +0000259 if (image->matte != MagickFalse)
cristy4c08aed2011-07-01 19:47:50 +0000260 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000261 p+=GetPixelChannels(canvas_image);
262 q+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000263 }
264 if (SyncAuthenticPixels(image,exception) == MagickFalse)
265 break;
266 }
267 if (image->previous == (Image *) NULL)
268 {
cristycee97112010-05-28 00:44:52 +0000269 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
270 image->rows);
cristy3ed852e2009-09-05 21:47:34 +0000271 if (status == MagickFalse)
272 break;
273 }
274 count=ReadBlob(image,length,pixels);
cristy3ed852e2009-09-05 21:47:34 +0000275 }
276 break;
277 }
278 case LineInterlace:
279 {
cristy90dbac72010-08-22 15:08:40 +0000280 static QuantumType
281 quantum_types[4] =
282 {
283 RedQuantum,
284 GreenQuantum,
285 BlueQuantum,
286 AlphaQuantum
287 };
288
cristy3ed852e2009-09-05 21:47:34 +0000289 /*
290 Line interlacing: RRR...GGG...BBB...RRR...GGG...BBB...
291 */
cristy90dbac72010-08-22 15:08:40 +0000292 if (LocaleCompare(image_info->magick,"RGBO") == 0)
293 quantum_types[3]=OpacityQuantum;
cristy3ed852e2009-09-05 21:47:34 +0000294 if (scene == 0)
295 {
cristy90dbac72010-08-22 15:08:40 +0000296 length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
cristy3ed852e2009-09-05 21:47:34 +0000297 count=ReadBlob(image,length,pixels);
cristy3ed852e2009-09-05 21:47:34 +0000298 }
cristybb503372010-05-27 20:51:26 +0000299 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000300 {
cristy4c08aed2011-07-01 19:47:50 +0000301 register const Quantum
cristyc47d1f82009-11-26 01:44:43 +0000302 *restrict p;
cristy3ed852e2009-09-05 21:47:34 +0000303
cristy4c08aed2011-07-01 19:47:50 +0000304 register Quantum
cristyc47d1f82009-11-26 01:44:43 +0000305 *restrict q;
cristy3ed852e2009-09-05 21:47:34 +0000306
cristy90dbac72010-08-22 15:08:40 +0000307 register ssize_t
308 x;
309
cristy21da32d2009-09-12 14:56:09 +0000310 if (count != (ssize_t) length)
311 {
312 ThrowFileException(exception,CorruptImageError,
313 "UnexpectedEndOfFile",image->filename);
314 break;
315 }
cristy90dbac72010-08-22 15:08:40 +0000316 for (i=0; i < (ssize_t) (image->matte != MagickFalse ? 4 : 3); i++)
cristy3ed852e2009-09-05 21:47:34 +0000317 {
cristy90dbac72010-08-22 15:08:40 +0000318 quantum_type=quantum_types[i];
cristy3ed852e2009-09-05 21:47:34 +0000319 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
320 exception);
cristyacd2ed22011-08-30 01:44:23 +0000321 if (q == (Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000322 break;
323 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
cristy90dbac72010-08-22 15:08:40 +0000324 quantum_info,quantum_type,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +0000325 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
326 break;
cristy90dbac72010-08-22 15:08:40 +0000327 if (((y-image->extract_info.y) >= 0) &&
cristybb503372010-05-27 20:51:26 +0000328 ((y-image->extract_info.y) < (ssize_t) image->rows))
cristy3ed852e2009-09-05 21:47:34 +0000329 {
330 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,
331 0,canvas_image->columns,1,exception);
332 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
333 image->columns,1,exception);
cristyddacdd12012-05-07 23:08:14 +0000334 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000335 break;
cristy90dbac72010-08-22 15:08:40 +0000336 for (x=0; x < (ssize_t) image->columns; x++)
337 {
338 switch (quantum_type)
cristy3ed852e2009-09-05 21:47:34 +0000339 {
cristy90dbac72010-08-22 15:08:40 +0000340 case RedQuantum:
341 {
cristy4c08aed2011-07-01 19:47:50 +0000342 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
cristy90dbac72010-08-22 15:08:40 +0000343 break;
344 }
345 case GreenQuantum:
346 {
cristy4c08aed2011-07-01 19:47:50 +0000347 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
cristy90dbac72010-08-22 15:08:40 +0000348 break;
349 }
350 case BlueQuantum:
351 {
cristy4c08aed2011-07-01 19:47:50 +0000352 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
cristy90dbac72010-08-22 15:08:40 +0000353 break;
354 }
355 case OpacityQuantum:
356 {
cristy4c08aed2011-07-01 19:47:50 +0000357 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
cristy90dbac72010-08-22 15:08:40 +0000358 break;
359 }
360 case AlphaQuantum:
361 {
cristy4c08aed2011-07-01 19:47:50 +0000362 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
cristy90dbac72010-08-22 15:08:40 +0000363 break;
364 }
365 default:
366 break;
cristy3ed852e2009-09-05 21:47:34 +0000367 }
cristyed231572011-07-14 02:18:59 +0000368 p+=GetPixelChannels(canvas_image);
369 q+=GetPixelChannels(image);
cristy90dbac72010-08-22 15:08:40 +0000370 }
cristy3ed852e2009-09-05 21:47:34 +0000371 if (SyncAuthenticPixels(image,exception) == MagickFalse)
372 break;
373 }
374 count=ReadBlob(image,length,pixels);
cristy3ed852e2009-09-05 21:47:34 +0000375 }
376 if (image->previous == (Image *) NULL)
377 {
cristycee97112010-05-28 00:44:52 +0000378 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
379 image->rows);
cristy3ed852e2009-09-05 21:47:34 +0000380 if (status == MagickFalse)
381 break;
382 }
383 }
384 break;
385 }
386 case PlaneInterlace:
387 {
388 /*
389 Plane interlacing: RRRRRR...GGGGGG...BBBBBB...
390 */
391 if (scene == 0)
392 {
cristy90dbac72010-08-22 15:08:40 +0000393 length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
cristy3ed852e2009-09-05 21:47:34 +0000394 count=ReadBlob(image,length,pixels);
cristy3ed852e2009-09-05 21:47:34 +0000395 }
cristy90dbac72010-08-22 15:08:40 +0000396 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000397 {
cristy4c08aed2011-07-01 19:47:50 +0000398 register const Quantum
cristy90dbac72010-08-22 15:08:40 +0000399 *restrict p;
cristy3ed852e2009-09-05 21:47:34 +0000400
cristy4c08aed2011-07-01 19:47:50 +0000401 register Quantum
cristy90dbac72010-08-22 15:08:40 +0000402 *restrict q;
cristy3ed852e2009-09-05 21:47:34 +0000403
cristy90dbac72010-08-22 15:08:40 +0000404 register ssize_t
405 x;
cristy3ed852e2009-09-05 21:47:34 +0000406
cristy90dbac72010-08-22 15:08:40 +0000407 if (count != (ssize_t) length)
cristy3ed852e2009-09-05 21:47:34 +0000408 {
cristy90dbac72010-08-22 15:08:40 +0000409 ThrowFileException(exception,CorruptImageError,
410 "UnexpectedEndOfFile",image->filename);
411 break;
412 }
413 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
414 exception);
cristyacd2ed22011-08-30 01:44:23 +0000415 if (q == (Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +0000416 break;
417 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
418 quantum_info,RedQuantum,pixels,exception);
419 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
420 break;
421 if (((y-image->extract_info.y) >= 0) &&
422 ((y-image->extract_info.y) < (ssize_t) image->rows))
423 {
424 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
425 canvas_image->columns,1,exception);
426 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
427 image->columns,1,exception);
cristyddacdd12012-05-07 23:08:14 +0000428 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
cristy90dbac72010-08-22 15:08:40 +0000429 break;
430 for (x=0; x < (ssize_t) image->columns; x++)
431 {
cristy4c08aed2011-07-01 19:47:50 +0000432 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000433 p+=GetPixelChannels(canvas_image);
434 q+=GetPixelChannels(image);
cristy90dbac72010-08-22 15:08:40 +0000435 }
436 if (SyncAuthenticPixels(image,exception) == MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +0000437 break;
438 }
cristy90dbac72010-08-22 15:08:40 +0000439 count=ReadBlob(image,length,pixels);
cristy3ed852e2009-09-05 21:47:34 +0000440 }
441 if (image->previous == (Image *) NULL)
442 {
cristy90dbac72010-08-22 15:08:40 +0000443 status=SetImageProgress(image,LoadImageTag,1,6);
444 if (status == MagickFalse)
445 break;
446 }
447 for (y=0; y < (ssize_t) image->extract_info.height; y++)
448 {
cristy4c08aed2011-07-01 19:47:50 +0000449 register const Quantum
cristy90dbac72010-08-22 15:08:40 +0000450 *restrict p;
451
cristy4c08aed2011-07-01 19:47:50 +0000452 register Quantum
cristy90dbac72010-08-22 15:08:40 +0000453 *restrict q;
454
455 register ssize_t
456 x;
457
458 if (count != (ssize_t) length)
459 {
460 ThrowFileException(exception,CorruptImageError,
461 "UnexpectedEndOfFile",image->filename);
462 break;
463 }
464 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
465 exception);
cristyacd2ed22011-08-30 01:44:23 +0000466 if (q == (Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +0000467 break;
468 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
469 quantum_info,GreenQuantum,pixels,exception);
470 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
471 break;
472 if (((y-image->extract_info.y) >= 0) &&
473 ((y-image->extract_info.y) < (ssize_t) image->rows))
474 {
475 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
476 canvas_image->columns,1,exception);
477 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
478 image->columns,1,exception);
cristyddacdd12012-05-07 23:08:14 +0000479 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
cristy90dbac72010-08-22 15:08:40 +0000480 break;
481 for (x=0; x < (ssize_t) image->columns; x++)
482 {
cristyf27ee032011-09-29 17:51:41 +0000483 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000484 p+=GetPixelChannels(canvas_image);
485 q+=GetPixelChannels(image);
cristy90dbac72010-08-22 15:08:40 +0000486 }
487 if (SyncAuthenticPixels(image,exception) == MagickFalse)
488 break;
489 }
490 count=ReadBlob(image,length,pixels);
491 }
492 if (image->previous == (Image *) NULL)
493 {
494 status=SetImageProgress(image,LoadImageTag,2,6);
495 if (status == MagickFalse)
496 break;
497 }
498 for (y=0; y < (ssize_t) image->extract_info.height; y++)
499 {
cristy4c08aed2011-07-01 19:47:50 +0000500 register const Quantum
cristy90dbac72010-08-22 15:08:40 +0000501 *restrict p;
502
cristy4c08aed2011-07-01 19:47:50 +0000503 register Quantum
cristy90dbac72010-08-22 15:08:40 +0000504 *restrict q;
505
506 register ssize_t
507 x;
508
509 if (count != (ssize_t) length)
510 {
511 ThrowFileException(exception,CorruptImageError,
512 "UnexpectedEndOfFile",image->filename);
513 break;
514 }
515 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
516 exception);
cristyacd2ed22011-08-30 01:44:23 +0000517 if (q == (Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +0000518 break;
519 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
520 quantum_info,BlueQuantum,pixels,exception);
521 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
522 break;
523 if (((y-image->extract_info.y) >= 0) &&
524 ((y-image->extract_info.y) < (ssize_t) image->rows))
525 {
526 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
527 canvas_image->columns,1,exception);
528 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
529 image->columns,1,exception);
cristyddacdd12012-05-07 23:08:14 +0000530 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
cristy90dbac72010-08-22 15:08:40 +0000531 break;
532 for (x=0; x < (ssize_t) image->columns; x++)
533 {
cristyf27ee032011-09-29 17:51:41 +0000534 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000535 p+=GetPixelChannels(canvas_image);
536 q+=GetPixelChannels(image);
cristy90dbac72010-08-22 15:08:40 +0000537 }
538 if (SyncAuthenticPixels(image,exception) == MagickFalse)
539 break;
540 }
541 count=ReadBlob(image,length,pixels);
542 }
543 if (image->previous == (Image *) NULL)
544 {
545 status=SetImageProgress(image,LoadImageTag,3,6);
546 if (status == MagickFalse)
547 break;
548 }
549 if (image->previous == (Image *) NULL)
550 {
551 status=SetImageProgress(image,LoadImageTag,4,6);
552 if (status == MagickFalse)
553 break;
554 }
555 if (image->matte != MagickFalse)
556 {
557 for (y=0; y < (ssize_t) image->extract_info.height; y++)
558 {
cristy4c08aed2011-07-01 19:47:50 +0000559 register const Quantum
cristy90dbac72010-08-22 15:08:40 +0000560 *restrict p;
561
cristy4c08aed2011-07-01 19:47:50 +0000562 register Quantum
cristy90dbac72010-08-22 15:08:40 +0000563 *restrict q;
564
565 register ssize_t
566 x;
567
568 if (count != (ssize_t) length)
569 {
570 ThrowFileException(exception,CorruptImageError,
571 "UnexpectedEndOfFile",image->filename);
572 break;
573 }
574 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
575 exception);
cristyacd2ed22011-08-30 01:44:23 +0000576 if (q == (Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +0000577 break;
578 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
579 quantum_info,AlphaQuantum,pixels,exception);
580 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
581 break;
582 if (((y-image->extract_info.y) >= 0) &&
583 ((y-image->extract_info.y) < (ssize_t) image->rows))
584 {
585 p=GetVirtualPixels(canvas_image,
586 canvas_image->extract_info.x,0,canvas_image->columns,1,
587 exception);
588 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
589 image->columns,1,exception);
cristyddacdd12012-05-07 23:08:14 +0000590 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
cristy90dbac72010-08-22 15:08:40 +0000591 break;
592 for (x=0; x < (ssize_t) image->columns; x++)
593 {
cristyf27ee032011-09-29 17:51:41 +0000594 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000595 p+=GetPixelChannels(canvas_image);
596 q+=GetPixelChannels(image);
cristy90dbac72010-08-22 15:08:40 +0000597 }
598 if (SyncAuthenticPixels(image,exception) == MagickFalse)
599 break;
600 }
601 count=ReadBlob(image,length,pixels);
602 }
603 if (image->previous == (Image *) NULL)
604 {
605 status=SetImageProgress(image,LoadImageTag,5,6);
606 if (status == MagickFalse)
607 break;
608 }
609 }
610 if (image->previous == (Image *) NULL)
611 {
612 status=SetImageProgress(image,LoadImageTag,6,6);
cristy3ed852e2009-09-05 21:47:34 +0000613 if (status == MagickFalse)
614 break;
615 }
616 break;
617 }
618 case PartitionInterlace:
619 {
620 /*
621 Partition interlacing: RRRRRR..., GGGGGG..., BBBBBB...
622 */
cristy90dbac72010-08-22 15:08:40 +0000623 AppendImageFormat("R",image->filename);
624 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
625 if (status == MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +0000626 {
cristy90dbac72010-08-22 15:08:40 +0000627 canvas_image=DestroyImageList(canvas_image);
628 image=DestroyImageList(image);
629 return((Image *) NULL);
630 }
cristyd4297022010-09-16 22:59:09 +0000631 if (DiscardBlobBytes(image,image->offset) == MagickFalse)
632 ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
633 image->filename);
cristy90dbac72010-08-22 15:08:40 +0000634 length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
635 for (i=0; i < (ssize_t) scene; i++)
636 for (y=0; y < (ssize_t) image->extract_info.height; y++)
637 if (ReadBlob(image,length,pixels) != (ssize_t) length)
cristy21da32d2009-09-12 14:56:09 +0000638 {
639 ThrowFileException(exception,CorruptImageError,
640 "UnexpectedEndOfFile",image->filename);
641 break;
642 }
cristy90dbac72010-08-22 15:08:40 +0000643 count=ReadBlob(image,length,pixels);
644 for (y=0; y < (ssize_t) image->extract_info.height; y++)
645 {
cristy4c08aed2011-07-01 19:47:50 +0000646 register const Quantum
cristy90dbac72010-08-22 15:08:40 +0000647 *restrict p;
648
cristy4c08aed2011-07-01 19:47:50 +0000649 register Quantum
cristy90dbac72010-08-22 15:08:40 +0000650 *restrict q;
651
652 register ssize_t
653 x;
654
655 if (count != (ssize_t) length)
cristy3ed852e2009-09-05 21:47:34 +0000656 {
cristy90dbac72010-08-22 15:08:40 +0000657 ThrowFileException(exception,CorruptImageError,
658 "UnexpectedEndOfFile",image->filename);
659 break;
660 }
661 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
662 exception);
cristyacd2ed22011-08-30 01:44:23 +0000663 if (q == (Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +0000664 break;
665 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
666 quantum_info,RedQuantum,pixels,exception);
667 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
668 break;
669 if (((y-image->extract_info.y) >= 0) &&
670 ((y-image->extract_info.y) < (ssize_t) image->rows))
671 {
672 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
673 canvas_image->columns,1,exception);
674 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
675 image->columns,1,exception);
cristyddacdd12012-05-07 23:08:14 +0000676 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
cristy90dbac72010-08-22 15:08:40 +0000677 break;
678 for (x=0; x < (ssize_t) image->columns; x++)
679 {
cristy4c08aed2011-07-01 19:47:50 +0000680 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000681 p+=GetPixelChannels(canvas_image);
682 q+=GetPixelChannels(image);
cristy90dbac72010-08-22 15:08:40 +0000683 }
684 if (SyncAuthenticPixels(image,exception) == MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +0000685 break;
686 }
cristy90dbac72010-08-22 15:08:40 +0000687 count=ReadBlob(image,length,pixels);
cristy3ed852e2009-09-05 21:47:34 +0000688 }
689 if (image->previous == (Image *) NULL)
690 {
cristy90dbac72010-08-22 15:08:40 +0000691 status=SetImageProgress(image,LoadImageTag,1,5);
692 if (status == MagickFalse)
693 break;
694 }
695 (void) CloseBlob(image);
696 AppendImageFormat("G",image->filename);
697 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
698 if (status == MagickFalse)
699 {
700 canvas_image=DestroyImageList(canvas_image);
701 image=DestroyImageList(image);
702 return((Image *) NULL);
703 }
704 length=GetQuantumExtent(canvas_image,quantum_info,GreenQuantum);
705 for (i=0; i < (ssize_t) scene; i++)
706 for (y=0; y < (ssize_t) image->extract_info.height; y++)
707 if (ReadBlob(image,length,pixels) != (ssize_t) length)
708 {
709 ThrowFileException(exception,CorruptImageError,
710 "UnexpectedEndOfFile",image->filename);
711 break;
712 }
713 count=ReadBlob(image,length,pixels);
714 for (y=0; y < (ssize_t) image->extract_info.height; y++)
715 {
cristy4c08aed2011-07-01 19:47:50 +0000716 register const Quantum
cristy90dbac72010-08-22 15:08:40 +0000717 *restrict p;
718
cristy4c08aed2011-07-01 19:47:50 +0000719 register Quantum
cristy90dbac72010-08-22 15:08:40 +0000720 *restrict q;
721
722 register ssize_t
723 x;
724
725 if (count != (ssize_t) length)
726 {
727 ThrowFileException(exception,CorruptImageError,
728 "UnexpectedEndOfFile",image->filename);
729 break;
730 }
731 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
732 exception);
cristyacd2ed22011-08-30 01:44:23 +0000733 if (q == (Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +0000734 break;
735 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
736 quantum_info,GreenQuantum,pixels,exception);
737 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
738 break;
739 if (((y-image->extract_info.y) >= 0) &&
740 ((y-image->extract_info.y) < (ssize_t) image->rows))
741 {
742 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
743 canvas_image->columns,1,exception);
744 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
745 image->columns,1,exception);
cristyddacdd12012-05-07 23:08:14 +0000746 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
cristy90dbac72010-08-22 15:08:40 +0000747 break;
748 for (x=0; x < (ssize_t) image->columns; x++)
749 {
cristyf27ee032011-09-29 17:51:41 +0000750 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000751 p+=GetPixelChannels(canvas_image);
752 q+=GetPixelChannels(image);
cristy90dbac72010-08-22 15:08:40 +0000753 }
754 if (SyncAuthenticPixels(image,exception) == MagickFalse)
755 break;
756 }
757 count=ReadBlob(image,length,pixels);
758 }
759 if (image->previous == (Image *) NULL)
760 {
761 status=SetImageProgress(image,LoadImageTag,2,5);
762 if (status == MagickFalse)
763 break;
764 }
765 (void) CloseBlob(image);
766 AppendImageFormat("B",image->filename);
767 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
768 if (status == MagickFalse)
769 {
770 canvas_image=DestroyImageList(canvas_image);
771 image=DestroyImageList(image);
772 return((Image *) NULL);
773 }
774 length=GetQuantumExtent(canvas_image,quantum_info,BlueQuantum);
775 for (i=0; i < (ssize_t) scene; i++)
776 for (y=0; y < (ssize_t) image->extract_info.height; y++)
777 if (ReadBlob(image,length,pixels) != (ssize_t) length)
778 {
779 ThrowFileException(exception,CorruptImageError,
780 "UnexpectedEndOfFile",image->filename);
781 break;
782 }
783 count=ReadBlob(image,length,pixels);
784 for (y=0; y < (ssize_t) image->extract_info.height; y++)
785 {
cristy4c08aed2011-07-01 19:47:50 +0000786 register const Quantum
cristy90dbac72010-08-22 15:08:40 +0000787 *restrict p;
788
cristy4c08aed2011-07-01 19:47:50 +0000789 register Quantum
cristy90dbac72010-08-22 15:08:40 +0000790 *restrict q;
791
792 register ssize_t
793 x;
794
795 if (count != (ssize_t) length)
796 {
797 ThrowFileException(exception,CorruptImageError,
798 "UnexpectedEndOfFile",image->filename);
799 break;
800 }
801 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
802 exception);
cristyacd2ed22011-08-30 01:44:23 +0000803 if (q == (Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +0000804 break;
805 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
806 quantum_info,BlueQuantum,pixels,exception);
807 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
808 break;
809 if (((y-image->extract_info.y) >= 0) &&
810 ((y-image->extract_info.y) < (ssize_t) image->rows))
811 {
812 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
813 canvas_image->columns,1,exception);
814 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
815 image->columns,1,exception);
cristyddacdd12012-05-07 23:08:14 +0000816 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
cristy90dbac72010-08-22 15:08:40 +0000817 break;
818 for (x=0; x < (ssize_t) image->columns; x++)
819 {
cristyf27ee032011-09-29 17:51:41 +0000820 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000821 p+=GetPixelChannels(canvas_image);
822 q+=GetPixelChannels(image);
cristy90dbac72010-08-22 15:08:40 +0000823 }
824 if (SyncAuthenticPixels(image,exception) == MagickFalse)
825 break;
826 }
827 count=ReadBlob(image,length,pixels);
828 }
829 if (image->previous == (Image *) NULL)
830 {
831 status=SetImageProgress(image,LoadImageTag,3,5);
832 if (status == MagickFalse)
833 break;
834 }
835 if (image->matte != MagickFalse)
836 {
837 (void) CloseBlob(image);
838 AppendImageFormat("A",image->filename);
839 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
840 if (status == MagickFalse)
841 {
842 canvas_image=DestroyImageList(canvas_image);
843 image=DestroyImageList(image);
844 return((Image *) NULL);
845 }
846 length=GetQuantumExtent(canvas_image,quantum_info,AlphaQuantum);
847 for (i=0; i < (ssize_t) scene; i++)
848 for (y=0; y < (ssize_t) image->extract_info.height; y++)
849 if (ReadBlob(image,length,pixels) != (ssize_t) length)
850 {
851 ThrowFileException(exception,CorruptImageError,
852 "UnexpectedEndOfFile",image->filename);
853 break;
854 }
855 count=ReadBlob(image,length,pixels);
856 for (y=0; y < (ssize_t) image->extract_info.height; y++)
857 {
cristy4c08aed2011-07-01 19:47:50 +0000858 register const Quantum
cristy90dbac72010-08-22 15:08:40 +0000859 *restrict p;
860
cristy4c08aed2011-07-01 19:47:50 +0000861 register Quantum
cristy90dbac72010-08-22 15:08:40 +0000862 *restrict q;
863
864 register ssize_t
865 x;
866
867 if (count != (ssize_t) length)
868 {
869 ThrowFileException(exception,CorruptImageError,
870 "UnexpectedEndOfFile",image->filename);
871 break;
872 }
873 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
874 exception);
cristyacd2ed22011-08-30 01:44:23 +0000875 if (q == (Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +0000876 break;
877 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
878 quantum_info,BlueQuantum,pixels,exception);
879 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
880 break;
881 if (((y-image->extract_info.y) >= 0) &&
882 ((y-image->extract_info.y) < (ssize_t) image->rows))
883 {
884 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,
885 0,canvas_image->columns,1,exception);
886 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
887 image->columns,1,exception);
cristyc6aebff2012-05-07 23:24:35 +0000888 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
cristy90dbac72010-08-22 15:08:40 +0000889 break;
890 for (x=0; x < (ssize_t) image->columns; x++)
891 {
cristyf27ee032011-09-29 17:51:41 +0000892 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000893 p+=GetPixelChannels(canvas_image);
894 q+=GetPixelChannels(image);
cristy90dbac72010-08-22 15:08:40 +0000895 }
896 if (SyncAuthenticPixels(image,exception) == MagickFalse)
897 break;
898 }
899 count=ReadBlob(image,length,pixels);
900 }
901 if (image->previous == (Image *) NULL)
902 {
903 status=SetImageProgress(image,LoadImageTag,4,5);
904 if (status == MagickFalse)
905 break;
906 }
907 }
908 (void) CloseBlob(image);
909 if (image->previous == (Image *) NULL)
910 {
cristy3ed852e2009-09-05 21:47:34 +0000911 status=SetImageProgress(image,LoadImageTag,5,5);
912 if (status == MagickFalse)
913 break;
914 }
915 break;
916 }
917 }
918 SetQuantumImageType(image,quantum_type);
cristy3ed852e2009-09-05 21:47:34 +0000919 /*
920 Proceed to next image.
921 */
922 if (image_info->number_scenes != 0)
923 if (image->scene >= (image_info->scene+image_info->number_scenes-1))
924 break;
925 if (count == (ssize_t) length)
926 {
927 /*
928 Allocate next image structure.
929 */
cristy9950d572011-10-01 18:22:35 +0000930 AcquireNextImage(image_info,image,exception);
cristy3ed852e2009-09-05 21:47:34 +0000931 if (GetNextImageInList(image) == (Image *) NULL)
932 {
933 image=DestroyImageList(image);
934 return((Image *) NULL);
935 }
936 image=SyncNextImageInList(image);
937 status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
938 GetBlobSize(image));
939 if (status == MagickFalse)
940 break;
941 }
942 scene++;
943 } while (count == (ssize_t) length);
cristy3ed852e2009-09-05 21:47:34 +0000944 quantum_info=DestroyQuantumInfo(quantum_info);
cristy3ed852e2009-09-05 21:47:34 +0000945 canvas_image=DestroyImage(canvas_image);
946 (void) CloseBlob(image);
947 return(GetFirstImageInList(image));
948}
949
950/*
951%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
952% %
953% %
954% %
955% R e g i s t e r R G B I m a g e %
956% %
957% %
958% %
959%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
960%
cristy90dbac72010-08-22 15:08:40 +0000961% RegisterRGBImage() adds attributes for the RGB image format to
cristy3ed852e2009-09-05 21:47:34 +0000962% the list of supported formats. The attributes include the image format
963% tag, a method to read and/or write the format, whether the format
964% supports the saving of more than one frame to the same file or blob,
965% whether the format supports native in-memory I/O, and a brief
966% description of the format.
967%
968% The format of the RegisterRGBImage method is:
969%
cristybb503372010-05-27 20:51:26 +0000970% size_t RegisterRGBImage(void)
cristy3ed852e2009-09-05 21:47:34 +0000971%
972*/
cristybb503372010-05-27 20:51:26 +0000973ModuleExport size_t RegisterRGBImage(void)
cristy3ed852e2009-09-05 21:47:34 +0000974{
975 MagickInfo
976 *entry;
977
978 entry=SetMagickInfo("RGB");
979 entry->decoder=(DecodeImageHandler *) ReadRGBImage;
980 entry->encoder=(EncodeImageHandler *) WriteRGBImage;
981 entry->raw=MagickTrue;
982 entry->endian_support=MagickTrue;
cristy3ed852e2009-09-05 21:47:34 +0000983 entry->description=ConstantString("Raw red, green, and blue samples");
984 entry->module=ConstantString("RGB");
985 (void) RegisterMagickInfo(entry);
cristy3ed852e2009-09-05 21:47:34 +0000986 entry=SetMagickInfo("RGBA");
987 entry->decoder=(DecodeImageHandler *) ReadRGBImage;
988 entry->encoder=(EncodeImageHandler *) WriteRGBImage;
989 entry->raw=MagickTrue;
990 entry->endian_support=MagickTrue;
cristy3ed852e2009-09-05 21:47:34 +0000991 entry->description=ConstantString("Raw red, green, blue, and alpha samples");
992 entry->module=ConstantString("RGB");
993 (void) RegisterMagickInfo(entry);
994 entry=SetMagickInfo("RGBO");
995 entry->decoder=(DecodeImageHandler *) ReadRGBImage;
996 entry->encoder=(EncodeImageHandler *) WriteRGBImage;
997 entry->raw=MagickTrue;
998 entry->endian_support=MagickTrue;
cristy90dbac72010-08-22 15:08:40 +0000999 entry->description=ConstantString("Raw red, green, blue, and opacity samples");
cristy3ed852e2009-09-05 21:47:34 +00001000 entry->module=ConstantString("RGB");
1001 (void) RegisterMagickInfo(entry);
1002 return(MagickImageCoderSignature);
1003}
1004
1005/*
1006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1007% %
1008% %
1009% %
1010% U n r e g i s t e r R G B I m a g e %
1011% %
1012% %
1013% %
1014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1015%
cristy90dbac72010-08-22 15:08:40 +00001016% UnregisterRGBImage() removes format registrations made by the RGB module
1017% from the list of supported formats.
cristy3ed852e2009-09-05 21:47:34 +00001018%
1019% The format of the UnregisterRGBImage method is:
1020%
1021% UnregisterRGBImage(void)
1022%
1023*/
1024ModuleExport void UnregisterRGBImage(void)
1025{
1026 (void) UnregisterMagickInfo("RGBO");
1027 (void) UnregisterMagickInfo("RGBA");
cristy3ed852e2009-09-05 21:47:34 +00001028 (void) UnregisterMagickInfo("RGB");
1029}
1030
1031/*
1032%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1033% %
1034% %
1035% %
1036% W r i t e R G B I m a g e %
1037% %
1038% %
1039% %
1040%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1041%
cristy90dbac72010-08-22 15:08:40 +00001042% WriteRGBImage() writes an image to a file in the RGB, RGBA, or RGBO
1043% rasterfile format.
cristy3ed852e2009-09-05 21:47:34 +00001044%
1045% The format of the WriteRGBImage method is:
1046%
cristy90dbac72010-08-22 15:08:40 +00001047% MagickBooleanType WriteRGBImage(const ImageInfo *image_info,
cristy3a37efd2011-08-28 20:31:03 +00001048% Image *image,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001049%
1050% A description of each parameter follows.
1051%
1052% o image_info: the image info.
1053%
1054% o image: The image.
1055%
cristy3a37efd2011-08-28 20:31:03 +00001056% o exception: return any errors or warnings in this structure.
1057%
cristy3ed852e2009-09-05 21:47:34 +00001058*/
cristyc6aebff2012-05-07 23:24:35 +00001059static MagickBooleanType WriteRGBImage(const ImageInfo *image_info,
1060 Image *image,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +00001061{
cristy3ed852e2009-09-05 21:47:34 +00001062 MagickBooleanType
1063 status;
1064
1065 MagickOffsetType
1066 scene;
1067
1068 QuantumInfo
1069 *quantum_info;
1070
1071 QuantumType
cristy90dbac72010-08-22 15:08:40 +00001072 quantum_type;
cristy3ed852e2009-09-05 21:47:34 +00001073
cristyc6da28e2011-04-28 01:41:35 +00001074 size_t
1075 length;
1076
cristy3ed852e2009-09-05 21:47:34 +00001077 ssize_t
cristy90dbac72010-08-22 15:08:40 +00001078 count,
1079 y;
cristy3ed852e2009-09-05 21:47:34 +00001080
cristy3ed852e2009-09-05 21:47:34 +00001081 unsigned char
1082 *pixels;
1083
cristy3ed852e2009-09-05 21:47:34 +00001084 /*
1085 Allocate memory for pixels.
1086 */
1087 assert(image_info != (const ImageInfo *) NULL);
1088 assert(image_info->signature == MagickSignature);
1089 assert(image != (Image *) NULL);
1090 assert(image->signature == MagickSignature);
1091 if (image->debug != MagickFalse)
1092 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
1093 if (image_info->interlace != PartitionInterlace)
1094 {
1095 /*
1096 Open output image file.
1097 */
cristyedf03fa2011-08-30 12:44:39 +00001098 status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
cristy3ed852e2009-09-05 21:47:34 +00001099 if (status == MagickFalse)
1100 return(status);
1101 }
1102 quantum_type=RGBQuantum;
cristy90dbac72010-08-22 15:08:40 +00001103 if (LocaleCompare(image_info->magick,"RGBA") == 0)
cristyc6aebff2012-05-07 23:24:35 +00001104 quantum_type=RGBAQuantum;
cristy90dbac72010-08-22 15:08:40 +00001105 if (LocaleCompare(image_info->magick,"RGBO") == 0)
cristyc6aebff2012-05-07 23:24:35 +00001106 quantum_type=RGBOQuantum;
cristy3ed852e2009-09-05 21:47:34 +00001107 scene=0;
1108 do
1109 {
1110 /*
1111 Convert MIFF to RGB raster pixels.
1112 */
cristy501c5592012-04-18 12:45:09 +00001113 if (IssRGBColorspace(image->colorspace) == MagickFalse)
cristy8d951092012-02-08 18:54:56 +00001114 (void) TransformImageColorspace(image,sRGBColorspace,exception);
cristy3ed852e2009-09-05 21:47:34 +00001115 if ((LocaleCompare(image_info->magick,"RGBA") == 0) &&
1116 (image->matte == MagickFalse))
cristy3a37efd2011-08-28 20:31:03 +00001117 (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
cristy3ed852e2009-09-05 21:47:34 +00001118 quantum_info=AcquireQuantumInfo(image_info,image);
1119 if (quantum_info == (QuantumInfo *) NULL)
1120 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
1121 pixels=GetQuantumPixels(quantum_info);
1122 switch (image_info->interlace)
1123 {
1124 case NoInterlace:
1125 default:
1126 {
cristy3ed852e2009-09-05 21:47:34 +00001127 /*
1128 No interlacing: RGBRGBRGBRGBRGBRGB...
1129 */
cristybb503372010-05-27 20:51:26 +00001130 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001131 {
cristy4c08aed2011-07-01 19:47:50 +00001132 register const Quantum
cristy90dbac72010-08-22 15:08:40 +00001133 *restrict p;
cristy3ed852e2009-09-05 21:47:34 +00001134
cristy3a37efd2011-08-28 20:31:03 +00001135 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001136 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001137 break;
cristy4c08aed2011-07-01 19:47:50 +00001138 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001139 quantum_type,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001140 count=WriteBlob(image,length,pixels);
1141 if (count != (ssize_t) length)
1142 break;
1143 if (image->previous == (Image *) NULL)
1144 {
cristycee97112010-05-28 00:44:52 +00001145 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
1146 image->rows);
cristy3ed852e2009-09-05 21:47:34 +00001147 if (status == MagickFalse)
1148 break;
1149 }
1150 }
cristy3ed852e2009-09-05 21:47:34 +00001151 break;
1152 }
1153 case LineInterlace:
1154 {
1155 /*
1156 Line interlacing: RRR...GGG...BBB...RRR...GGG...BBB...
1157 */
cristybb503372010-05-27 20:51:26 +00001158 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001159 {
cristy4c08aed2011-07-01 19:47:50 +00001160 register const Quantum
cristyc47d1f82009-11-26 01:44:43 +00001161 *restrict p;
cristy3ed852e2009-09-05 21:47:34 +00001162
cristy3a37efd2011-08-28 20:31:03 +00001163 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001164 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001165 break;
cristy4c08aed2011-07-01 19:47:50 +00001166 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001167 RedQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001168 count=WriteBlob(image,length,pixels);
1169 if (count != (ssize_t) length)
1170 break;
cristy4c08aed2011-07-01 19:47:50 +00001171 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001172 GreenQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001173 count=WriteBlob(image,length,pixels);
1174 if (count != (ssize_t) length)
1175 break;
cristy4c08aed2011-07-01 19:47:50 +00001176 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001177 BlueQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001178 count=WriteBlob(image,length,pixels);
1179 if (count != (ssize_t) length)
1180 break;
1181 if (quantum_type == RGBAQuantum)
1182 {
cristy4c08aed2011-07-01 19:47:50 +00001183 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001184 AlphaQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001185 count=WriteBlob(image,length,pixels);
1186 if (count != (ssize_t) length)
1187 break;
1188 }
1189 if (quantum_type == RGBOQuantum)
1190 {
cristy4c08aed2011-07-01 19:47:50 +00001191 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001192 OpacityQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001193 count=WriteBlob(image,length,pixels);
1194 if (count != (ssize_t) length)
1195 break;
1196 }
cristy3ed852e2009-09-05 21:47:34 +00001197 if (image->previous == (Image *) NULL)
1198 {
cristycee97112010-05-28 00:44:52 +00001199 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
1200 image->rows);
cristy3ed852e2009-09-05 21:47:34 +00001201 if (status == MagickFalse)
1202 break;
1203 }
1204 }
1205 break;
1206 }
1207 case PlaneInterlace:
1208 {
1209 /*
1210 Plane interlacing: RRRRRR...GGGGGG...BBBBBB...
1211 */
cristy90dbac72010-08-22 15:08:40 +00001212 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001213 {
cristy4c08aed2011-07-01 19:47:50 +00001214 register const Quantum
cristy90dbac72010-08-22 15:08:40 +00001215 *restrict p;
cristy3ed852e2009-09-05 21:47:34 +00001216
cristy3a37efd2011-08-28 20:31:03 +00001217 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001218 if (p == (const Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +00001219 break;
cristy4c08aed2011-07-01 19:47:50 +00001220 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001221 RedQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001222 count=WriteBlob(image,length,pixels);
1223 if (count != (ssize_t) length)
1224 break;
cristy3ed852e2009-09-05 21:47:34 +00001225 }
1226 if (image->previous == (Image *) NULL)
1227 {
cristy90dbac72010-08-22 15:08:40 +00001228 status=SetImageProgress(image,SaveImageTag,1,6);
1229 if (status == MagickFalse)
1230 break;
1231 }
1232 for (y=0; y < (ssize_t) image->rows; y++)
1233 {
cristy4c08aed2011-07-01 19:47:50 +00001234 register const Quantum
cristy90dbac72010-08-22 15:08:40 +00001235 *restrict p;
1236
cristy3a37efd2011-08-28 20:31:03 +00001237 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001238 if (p == (const Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +00001239 break;
cristy4c08aed2011-07-01 19:47:50 +00001240 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001241 GreenQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001242 count=WriteBlob(image,length,pixels);
1243 if (count != (ssize_t) length)
1244 break;
1245 }
1246 if (image->previous == (Image *) NULL)
1247 {
1248 status=SetImageProgress(image,SaveImageTag,2,6);
1249 if (status == MagickFalse)
1250 break;
1251 }
1252 for (y=0; y < (ssize_t) image->rows; y++)
1253 {
cristy4c08aed2011-07-01 19:47:50 +00001254 register const Quantum
cristy90dbac72010-08-22 15:08:40 +00001255 *restrict p;
1256
cristy3a37efd2011-08-28 20:31:03 +00001257 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001258 if (p == (const Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +00001259 break;
cristy4c08aed2011-07-01 19:47:50 +00001260 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001261 BlueQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001262 count=WriteBlob(image,length,pixels);
1263 if (count != (ssize_t) length)
1264 break;
1265 }
1266 if (image->previous == (Image *) NULL)
1267 {
1268 status=SetImageProgress(image,SaveImageTag,3,6);
1269 if (status == MagickFalse)
1270 break;
1271 }
1272 if (quantum_type == RGBAQuantum)
1273 {
1274 for (y=0; y < (ssize_t) image->rows; y++)
1275 {
cristy4c08aed2011-07-01 19:47:50 +00001276 register const Quantum
cristy90dbac72010-08-22 15:08:40 +00001277 *restrict p;
1278
cristy3a37efd2011-08-28 20:31:03 +00001279 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001280 if (p == (const Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +00001281 break;
cristy4c08aed2011-07-01 19:47:50 +00001282 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001283 AlphaQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001284 count=WriteBlob(image,length,pixels);
1285 if (count != (ssize_t) length)
1286 break;
1287 }
1288 if (image->previous == (Image *) NULL)
1289 {
1290 status=SetImageProgress(image,SaveImageTag,5,6);
1291 if (status == MagickFalse)
1292 break;
1293 }
1294 }
1295 if (image_info->interlace == PartitionInterlace)
1296 (void) CopyMagickString(image->filename,image_info->filename,
1297 MaxTextExtent);
1298 if (image->previous == (Image *) NULL)
1299 {
1300 status=SetImageProgress(image,SaveImageTag,6,6);
cristy3ed852e2009-09-05 21:47:34 +00001301 if (status == MagickFalse)
1302 break;
1303 }
1304 break;
1305 }
1306 case PartitionInterlace:
1307 {
cristy3ed852e2009-09-05 21:47:34 +00001308 /*
1309 Partition interlacing: RRRRRR..., GGGGGG..., BBBBBB...
1310 */
cristy90dbac72010-08-22 15:08:40 +00001311 AppendImageFormat("R",image->filename);
1312 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
cristy3a37efd2011-08-28 20:31:03 +00001313 AppendBinaryBlobMode,exception);
cristy90dbac72010-08-22 15:08:40 +00001314 if (status == MagickFalse)
1315 return(status);
1316 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001317 {
cristy4c08aed2011-07-01 19:47:50 +00001318 register const Quantum
cristy90dbac72010-08-22 15:08:40 +00001319 *restrict p;
cristy3ed852e2009-09-05 21:47:34 +00001320
cristy3a37efd2011-08-28 20:31:03 +00001321 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001322 if (p == (const Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +00001323 break;
cristy4c08aed2011-07-01 19:47:50 +00001324 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001325 RedQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001326 count=WriteBlob(image,length,pixels);
1327 if (count != (ssize_t) length)
1328 break;
1329 }
1330 if (image->previous == (Image *) NULL)
1331 {
1332 status=SetImageProgress(image,SaveImageTag,1,6);
1333 if (status == MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00001334 break;
1335 }
cristy90dbac72010-08-22 15:08:40 +00001336 (void) CloseBlob(image);
1337 AppendImageFormat("G",image->filename);
1338 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
cristy3a37efd2011-08-28 20:31:03 +00001339 AppendBinaryBlobMode,exception);
cristy90dbac72010-08-22 15:08:40 +00001340 if (status == MagickFalse)
1341 return(status);
1342 for (y=0; y < (ssize_t) image->rows; y++)
1343 {
cristy4c08aed2011-07-01 19:47:50 +00001344 register const Quantum
cristy90dbac72010-08-22 15:08:40 +00001345 *restrict p;
1346
cristy3a37efd2011-08-28 20:31:03 +00001347 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001348 if (p == (const Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +00001349 break;
cristy4c08aed2011-07-01 19:47:50 +00001350 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001351 GreenQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001352 count=WriteBlob(image,length,pixels);
1353 if (count != (ssize_t) length)
1354 break;
1355 }
1356 if (image->previous == (Image *) NULL)
1357 {
1358 status=SetImageProgress(image,SaveImageTag,2,6);
1359 if (status == MagickFalse)
1360 break;
1361 }
1362 (void) CloseBlob(image);
1363 AppendImageFormat("B",image->filename);
1364 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
cristy3a37efd2011-08-28 20:31:03 +00001365 AppendBinaryBlobMode,exception);
cristy90dbac72010-08-22 15:08:40 +00001366 if (status == MagickFalse)
1367 return(status);
1368 for (y=0; y < (ssize_t) image->rows; y++)
1369 {
cristy4c08aed2011-07-01 19:47:50 +00001370 register const Quantum
cristy90dbac72010-08-22 15:08:40 +00001371 *restrict p;
1372
cristy3a37efd2011-08-28 20:31:03 +00001373 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001374 if (p == (const Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +00001375 break;
cristy4c08aed2011-07-01 19:47:50 +00001376 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001377 BlueQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001378 count=WriteBlob(image,length,pixels);
1379 if (count != (ssize_t) length)
1380 break;
1381 }
1382 if (image->previous == (Image *) NULL)
1383 {
1384 status=SetImageProgress(image,SaveImageTag,3,6);
1385 if (status == MagickFalse)
1386 break;
1387 }
1388 (void) CloseBlob(image);
1389 if (quantum_type == RGBAQuantum)
1390 {
1391 (void) CloseBlob(image);
1392 AppendImageFormat("A",image->filename);
1393 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
cristy3a37efd2011-08-28 20:31:03 +00001394 AppendBinaryBlobMode,exception);
cristy90dbac72010-08-22 15:08:40 +00001395 if (status == MagickFalse)
1396 return(status);
1397 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001398 {
cristy4c08aed2011-07-01 19:47:50 +00001399 register const Quantum
cristy90dbac72010-08-22 15:08:40 +00001400 *restrict p;
1401
cristy3a37efd2011-08-28 20:31:03 +00001402 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001403 if (p == (const Quantum *) NULL)
cristy90dbac72010-08-22 15:08:40 +00001404 break;
cristy4c08aed2011-07-01 19:47:50 +00001405 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001406 AlphaQuantum,pixels,exception);
cristy90dbac72010-08-22 15:08:40 +00001407 count=WriteBlob(image,length,pixels);
1408 if (count != (ssize_t) length)
cristy3ed852e2009-09-05 21:47:34 +00001409 break;
1410 }
cristy90dbac72010-08-22 15:08:40 +00001411 if (image->previous == (Image *) NULL)
1412 {
1413 status=SetImageProgress(image,SaveImageTag,5,6);
1414 if (status == MagickFalse)
1415 break;
1416 }
1417 }
1418 (void) CloseBlob(image);
cristy3ed852e2009-09-05 21:47:34 +00001419 (void) CopyMagickString(image->filename,image_info->filename,
1420 MaxTextExtent);
1421 if (image->previous == (Image *) NULL)
1422 {
cristy90dbac72010-08-22 15:08:40 +00001423 status=SetImageProgress(image,SaveImageTag,6,6);
cristy3ed852e2009-09-05 21:47:34 +00001424 if (status == MagickFalse)
1425 break;
1426 }
1427 break;
1428 }
1429 }
1430 quantum_info=DestroyQuantumInfo(quantum_info);
1431 if (GetNextImageInList(image) == (Image *) NULL)
1432 break;
1433 image=SyncNextImageInList(image);
1434 status=SetImageProgress(image,SaveImagesTag,scene++,
1435 GetImageListLength(image));
1436 if (status == MagickFalse)
1437 break;
1438 } while (image_info->adjoin != MagickFalse);
1439 (void) CloseBlob(image);
1440 return(MagickTrue);
1441}