blob: 568d8849a9eb945fb84caf263a7a9251ae71611b [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3% %
4% %
5% %
6% Y Y YYYC BBBB YYYC RRRR %
7% Y Y C B B C R R %
8% Y C BBBB C RRRR %
9% Y C B B C R R %
10% Y YYYC BBBB YYYC R R %
11% %
12% %
13% Read/Write Raw YCbCr Image Format %
14% %
15% Software Design %
cristyde984cd2013-12-01 14:49:27 +000016% Cristy %
cristy3ed852e2009-09-05 21:47:34 +000017% July 1992 %
18% %
19% %
Cristy7ce65e72015-12-12 18:03:16 -050020% Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization %
cristy3ed852e2009-09-05 21:47:34 +000021% 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"
cristybc359602013-05-27 15:24:26 +000046#include "MagickCore/channel.h"
cristy4c08aed2011-07-01 19:47:50 +000047#include "MagickCore/colorspace.h"
48#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 WriteYCBCRImage(const ImageInfo *,Image *,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +000071
72/*
73%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74% %
75% %
76% %
77% R e a d Y C b C r I m a g e %
78% %
79% %
80% %
81%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82%
83% ReadYCBCRImage() reads an image of raw YCbCr or YCbCrA samples and returns
84% it. It allocates the memory necessary for the new Image structure and
85% returns a pointer to the new image.
86%
87% The format of the ReadYCBCRImage method is:
88%
89% Image *ReadYCBCRImage(const ImageInfo *image_info,
90% ExceptionInfo *exception)
91%
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*/
99static Image *ReadYCBCRImage(const ImageInfo *image_info,
100 ExceptionInfo *exception)
101{
cristyb3f97ae2015-05-18 12:29:32 +0000102 const unsigned char
cristybd797f12015-01-24 20:42:32 +0000103 *pixels;
104
cristy3ed852e2009-09-05 21:47:34 +0000105 Image
106 *canvas_image,
107 *image;
108
cristy3ed852e2009-09-05 21:47:34 +0000109 MagickBooleanType
110 status;
111
112 MagickOffsetType
113 scene;
114
115 QuantumInfo
116 *quantum_info;
117
118 QuantumType
119 quantum_type;
120
cristy4c08aed2011-07-01 19:47:50 +0000121 register const Quantum
cristy3ed852e2009-09-05 21:47:34 +0000122 *p;
123
cristybb503372010-05-27 20:51:26 +0000124 register ssize_t
cristy3ed852e2009-09-05 21:47:34 +0000125 i,
126 x;
127
cristy4c08aed2011-07-01 19:47:50 +0000128 register Quantum
cristy3ed852e2009-09-05 21:47:34 +0000129 *q;
130
cristy3ed852e2009-09-05 21:47:34 +0000131 size_t
132 length;
133
cristyc6da28e2011-04-28 01:41:35 +0000134 ssize_t
135 count,
136 y;
137
cristy3ed852e2009-09-05 21:47:34 +0000138 /*
139 Open image file.
140 */
141 assert(image_info != (const ImageInfo *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000142 assert(image_info->signature == MagickCoreSignature);
cristy3ed852e2009-09-05 21:47:34 +0000143 if (image_info->debug != MagickFalse)
144 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
145 image_info->filename);
146 assert(exception != (ExceptionInfo *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000147 assert(exception->signature == MagickCoreSignature);
cristy9950d572011-10-01 18:22:35 +0000148 image=AcquireImage(image_info,exception);
cristy3ed852e2009-09-05 21:47:34 +0000149 if ((image->columns == 0) || (image->rows == 0))
150 ThrowReaderException(OptionError,"MustSpecifyImageSize");
cristyacabb842014-12-14 23:36:33 +0000151 status=SetImageExtent(image,image->columns,image->rows,exception);
152 if (status == MagickFalse)
153 return(DestroyImageList(image));
cristye2c4f182012-05-12 14:11:53 +0000154 SetImageColorspace(image,YCbCrColorspace,exception);
cristy3ed852e2009-09-05 21:47:34 +0000155 if (image_info->interlace != PartitionInterlace)
156 {
157 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
158 if (status == MagickFalse)
159 {
160 image=DestroyImageList(image);
161 return((Image *) NULL);
162 }
cristyd4297022010-09-16 22:59:09 +0000163 if (DiscardBlobBytes(image,image->offset) == MagickFalse)
164 ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
165 image->filename);
cristy3ed852e2009-09-05 21:47:34 +0000166 }
167 /*
168 Create virtual canvas to support cropping (i.e. image.rgb[100x100+10+20]).
169 */
170 canvas_image=CloneImage(image,image->extract_info.width,1,MagickFalse,
171 exception);
cristy387430f2012-02-07 13:09:46 +0000172 (void) SetImageVirtualPixelMethod(canvas_image,BlackVirtualPixelMethod,
173 exception);
cristy5f766ef2014-12-14 21:12:47 +0000174 quantum_info=AcquireQuantumInfo(image_info,canvas_image);
cristy3ed852e2009-09-05 21:47:34 +0000175 if (quantum_info == (QuantumInfo *) NULL)
176 ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
cristy3ed852e2009-09-05 21:47:34 +0000177 quantum_type=RGBQuantum;
178 if (LocaleCompare(image_info->magick,"YCbCrA") == 0)
179 {
180 quantum_type=RGBAQuantum;
cristy8a46d822012-08-28 23:32:39 +0000181 image->alpha_trait=BlendPixelTrait;
cristy3ed852e2009-09-05 21:47:34 +0000182 }
cristyb3f97ae2015-05-18 12:29:32 +0000183 pixels=(const unsigned char *) NULL;
cristy3ed852e2009-09-05 21:47:34 +0000184 if (image_info->number_scenes != 0)
185 while (image->scene < image_info->scene)
186 {
187 /*
188 Skip to next image.
189 */
190 image->scene++;
191 length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
cristybb503372010-05-27 20:51:26 +0000192 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +0000193 {
cristyb3f97ae2015-05-18 12:29:32 +0000194 pixels=(const unsigned char *) ReadBlobStream(image,length,
195 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000196 if (count != (ssize_t) length)
197 break;
198 }
199 }
200 count=0;
201 length=0;
202 scene=0;
203 do
204 {
205 /*
206 Read pixels to virtual canvas image then push to image.
207 */
208 if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
209 if (image->scene >= (image_info->scene+image_info->number_scenes-1))
210 break;
cristyacabb842014-12-14 23:36:33 +0000211 status=SetImageExtent(image,image->columns,image->rows,exception);
212 if (status == MagickFalse)
213 return(DestroyImageList(image));
cristye2c4f182012-05-12 14:11:53 +0000214 SetImageColorspace(image,YCbCrColorspace,exception);
cristy3ed852e2009-09-05 21:47:34 +0000215 switch (image_info->interlace)
216 {
217 case NoInterlace:
218 default:
219 {
220 /*
221 No interlacing: YCbCrYCbCrYCbCrYCbCrYCbCrYCbCr...
222 */
223 if (scene == 0)
224 {
225 length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
cristyb3f97ae2015-05-18 12:29:32 +0000226 pixels=(const unsigned char *) ReadBlobStream(image,length,
227 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000228 }
cristybb503372010-05-27 20:51:26 +0000229 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000230 {
cristy21da32d2009-09-12 14:56:09 +0000231 if (count != (ssize_t) length)
232 {
233 ThrowFileException(exception,CorruptImageError,
234 "UnexpectedEndOfFile",image->filename);
235 break;
236 }
cristy3ed852e2009-09-05 21:47:34 +0000237 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
238 exception);
cristyacd2ed22011-08-30 01:44:23 +0000239 if (q == (Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000240 break;
241 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
242 quantum_info,quantum_type,pixels,exception);
243 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
244 break;
245 if (((y-image->extract_info.y) >= 0) &&
cristybb503372010-05-27 20:51:26 +0000246 ((y-image->extract_info.y) < (ssize_t) image->rows))
cristy3ed852e2009-09-05 21:47:34 +0000247 {
248 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
249 canvas_image->columns,1,exception);
250 q=QueueAuthenticPixels(image,0,y-image->extract_info.y,
251 image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +0000252 if ((p == (const Quantum *) NULL) ||
cristyacd2ed22011-08-30 01:44:23 +0000253 (q == (Quantum *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000254 break;
cristybb503372010-05-27 20:51:26 +0000255 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000256 {
cristy4c08aed2011-07-01 19:47:50 +0000257 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
258 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
259 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
cristy17f11b02014-12-20 19:37:04 +0000260 if (image->alpha_trait != UndefinedPixelTrait)
cristy4c08aed2011-07-01 19:47:50 +0000261 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000262 p+=GetPixelChannels(canvas_image);
263 q+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000264 }
265 if (SyncAuthenticPixels(image,exception) == MagickFalse)
266 break;
267 }
268 if (image->previous == (Image *) NULL)
269 {
cristycee97112010-05-28 00:44:52 +0000270 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
271 image->rows);
cristy3ed852e2009-09-05 21:47:34 +0000272 if (status == MagickFalse)
273 break;
274 }
cristyb3f97ae2015-05-18 12:29:32 +0000275 pixels=(const unsigned char *) ReadBlobStream(image,length,
276 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000277 }
278 break;
279 }
280 case LineInterlace:
281 {
282 static QuantumType
283 quantum_types[4] =
284 {
285 RedQuantum,
286 GreenQuantum,
287 BlueQuantum,
288 OpacityQuantum
289 };
290
291 /*
292 Line interlacing: YYY...CbCbCb...CrCrCr...YYY...CbCbCb...CrCrCr...
293 */
294 if (scene == 0)
295 {
296 length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
cristyb3f97ae2015-05-18 12:29:32 +0000297 pixels=(const unsigned char *) ReadBlobStream(image,length,
298 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000299 }
cristybb503372010-05-27 20:51:26 +0000300 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000301 {
cristy17f11b02014-12-20 19:37:04 +0000302 for (i=0; i < (image->alpha_trait != UndefinedPixelTrait ? 4 : 3); i++)
cristy3ed852e2009-09-05 21:47:34 +0000303 {
cristy21da32d2009-09-12 14:56:09 +0000304 if (count != (ssize_t) length)
305 {
306 ThrowFileException(exception,CorruptImageError,
307 "UnexpectedEndOfFile",image->filename);
308 break;
309 }
cristy3ed852e2009-09-05 21:47:34 +0000310 quantum_type=quantum_types[i];
311 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
312 exception);
cristyacd2ed22011-08-30 01:44:23 +0000313 if (q == (Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000314 break;
315 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
316 quantum_info,quantum_type,pixels,exception);
317 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
318 break;
319 if (((y-image->extract_info.y) >= 0) &&
cristybb503372010-05-27 20:51:26 +0000320 ((y-image->extract_info.y) < (ssize_t) image->rows))
cristy3ed852e2009-09-05 21:47:34 +0000321 {
322 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,
323 0,canvas_image->columns,1,exception);
324 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
325 image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +0000326 if ((p == (const Quantum *) NULL) ||
cristyacd2ed22011-08-30 01:44:23 +0000327 (q == (Quantum *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000328 break;
cristybb503372010-05-27 20:51:26 +0000329 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000330 {
331 switch (quantum_type)
332 {
cristyee934782011-02-08 20:25:00 +0000333 case RedQuantum:
334 {
cristy4c08aed2011-07-01 19:47:50 +0000335 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
cristyee934782011-02-08 20:25:00 +0000336 break;
337 }
338 case GreenQuantum:
339 {
cristy4c08aed2011-07-01 19:47:50 +0000340 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
cristyee934782011-02-08 20:25:00 +0000341 break;
342 }
343 case BlueQuantum:
344 {
cristy4c08aed2011-07-01 19:47:50 +0000345 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
cristyee934782011-02-08 20:25:00 +0000346 break;
347 }
348 case OpacityQuantum:
349 {
cristy4c08aed2011-07-01 19:47:50 +0000350 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
cristyee934782011-02-08 20:25:00 +0000351 break;
352 }
353 default:
354 break;
cristy3ed852e2009-09-05 21:47:34 +0000355 }
cristyed231572011-07-14 02:18:59 +0000356 p+=GetPixelChannels(canvas_image);
357 q+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000358 }
359 if (SyncAuthenticPixels(image,exception) == MagickFalse)
360 break;
361 }
cristyb3f97ae2015-05-18 12:29:32 +0000362 pixels=(const unsigned char *) ReadBlobStream(image,length,
363 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000364 }
365 if (image->previous == (Image *) NULL)
366 {
cristycee97112010-05-28 00:44:52 +0000367 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
368 image->rows);
cristy3ed852e2009-09-05 21:47:34 +0000369 if (status == MagickFalse)
370 break;
371 }
372 }
373 break;
374 }
375 case PlaneInterlace:
376 {
377 /*
378 Plane interlacing: YYYYYY...CbCbCbCbCbCb...CrCrCrCrCrCr...
379 */
380 if (scene == 0)
381 {
382 length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
cristyb3f97ae2015-05-18 12:29:32 +0000383 pixels=(const unsigned char *) ReadBlobStream(image,length,
384 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000385 }
cristybb503372010-05-27 20:51:26 +0000386 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000387 {
cristy21da32d2009-09-12 14:56:09 +0000388 if (count != (ssize_t) length)
389 {
390 ThrowFileException(exception,CorruptImageError,
391 "UnexpectedEndOfFile",image->filename);
392 break;
393 }
cristy3ed852e2009-09-05 21:47:34 +0000394 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
395 exception);
cristyacd2ed22011-08-30 01:44:23 +0000396 if (q == (Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000397 break;
398 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
399 quantum_info,RedQuantum,pixels,exception);
400 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
401 break;
402 if (((y-image->extract_info.y) >= 0) &&
cristybb503372010-05-27 20:51:26 +0000403 ((y-image->extract_info.y) < (ssize_t) image->rows))
cristy3ed852e2009-09-05 21:47:34 +0000404 {
405 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
406 canvas_image->columns,1,exception);
407 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
408 image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +0000409 if ((p == (const Quantum *) NULL) ||
cristyacd2ed22011-08-30 01:44:23 +0000410 (q == (Quantum *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000411 break;
cristybb503372010-05-27 20:51:26 +0000412 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000413 {
cristy4c08aed2011-07-01 19:47:50 +0000414 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000415 p+=GetPixelChannels(canvas_image);
416 q+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000417 }
418 if (SyncAuthenticPixels(image,exception) == MagickFalse)
419 break;
420 }
cristyb3f97ae2015-05-18 12:29:32 +0000421 pixels=(const unsigned char *) ReadBlobStream(image,length,
422 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000423 }
424 if (image->previous == (Image *) NULL)
425 {
426 status=SetImageProgress(image,LoadImageTag,1,5);
427 if (status == MagickFalse)
428 break;
429 }
cristybb503372010-05-27 20:51:26 +0000430 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000431 {
cristy21da32d2009-09-12 14:56:09 +0000432 if (count != (ssize_t) length)
433 {
434 ThrowFileException(exception,CorruptImageError,
435 "UnexpectedEndOfFile",image->filename);
436 break;
437 }
cristy3ed852e2009-09-05 21:47:34 +0000438 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
439 exception);
cristyacd2ed22011-08-30 01:44:23 +0000440 if (q == (Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000441 break;
442 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
443 quantum_info,GreenQuantum,pixels,exception);
444 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
445 break;
446 if (((y-image->extract_info.y) >= 0) &&
cristybb503372010-05-27 20:51:26 +0000447 ((y-image->extract_info.y) < (ssize_t) image->rows))
cristy3ed852e2009-09-05 21:47:34 +0000448 {
449 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
450 canvas_image->columns,1,exception);
451 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
452 image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +0000453 if ((p == (const Quantum *) NULL) ||
cristyacd2ed22011-08-30 01:44:23 +0000454 (q == (Quantum *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000455 break;
cristybb503372010-05-27 20:51:26 +0000456 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000457 {
cristy4c08aed2011-07-01 19:47:50 +0000458 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000459 p+=GetPixelChannels(canvas_image);
460 q+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000461 }
462 if (SyncAuthenticPixels(image,exception) == MagickFalse)
463 break;
464 }
cristyb3f97ae2015-05-18 12:29:32 +0000465 pixels=(const unsigned char *) ReadBlobStream(image,length,
466 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000467 }
468 if (image->previous == (Image *) NULL)
469 {
470 status=SetImageProgress(image,LoadImageTag,2,5);
471 if (status == MagickFalse)
472 break;
473 }
cristybb503372010-05-27 20:51:26 +0000474 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000475 {
cristy21da32d2009-09-12 14:56:09 +0000476 if (count != (ssize_t) length)
477 {
478 ThrowFileException(exception,CorruptImageError,
479 "UnexpectedEndOfFile",image->filename);
480 break;
481 }
cristy3ed852e2009-09-05 21:47:34 +0000482 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
483 exception);
cristyacd2ed22011-08-30 01:44:23 +0000484 if (q == (Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000485 break;
486 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
487 quantum_info,BlueQuantum,pixels,exception);
488 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
489 break;
490 if (((y-image->extract_info.y) >= 0) &&
cristybb503372010-05-27 20:51:26 +0000491 ((y-image->extract_info.y) < (ssize_t) image->rows))
cristy3ed852e2009-09-05 21:47:34 +0000492 {
493 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
494 canvas_image->columns,1,exception);
495 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
496 image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +0000497 if ((p == (const Quantum *) NULL) ||
cristyacd2ed22011-08-30 01:44:23 +0000498 (q == (Quantum *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000499 break;
cristybb503372010-05-27 20:51:26 +0000500 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000501 {
cristy4c08aed2011-07-01 19:47:50 +0000502 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000503 p+=GetPixelChannels(canvas_image);
504 q+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000505 }
506 if (SyncAuthenticPixels(image,exception) == MagickFalse)
507 break;
508 }
cristyb3f97ae2015-05-18 12:29:32 +0000509 pixels=(const unsigned char *) ReadBlobStream(image,length,
510 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000511 }
512 if (image->previous == (Image *) NULL)
513 {
514 status=SetImageProgress(image,LoadImageTag,3,5);
515 if (status == MagickFalse)
516 break;
517 }
cristy17f11b02014-12-20 19:37:04 +0000518 if (image->alpha_trait != UndefinedPixelTrait)
cristy3ed852e2009-09-05 21:47:34 +0000519 {
cristybb503372010-05-27 20:51:26 +0000520 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000521 {
cristy21da32d2009-09-12 14:56:09 +0000522 if (count != (ssize_t) length)
523 {
524 ThrowFileException(exception,CorruptImageError,
525 "UnexpectedEndOfFile",image->filename);
526 break;
527 }
cristy3ed852e2009-09-05 21:47:34 +0000528 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
529 exception);
cristyacd2ed22011-08-30 01:44:23 +0000530 if (q == (Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000531 break;
532 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
533 quantum_info,AlphaQuantum,pixels,exception);
534 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
535 break;
536 if (((y-image->extract_info.y) >= 0) &&
cristybb503372010-05-27 20:51:26 +0000537 ((y-image->extract_info.y) < (ssize_t) image->rows))
cristy3ed852e2009-09-05 21:47:34 +0000538 {
539 p=GetVirtualPixels(canvas_image,
540 canvas_image->extract_info.x,0,canvas_image->columns,1,
541 exception);
542 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
543 image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +0000544 if ((p == (const Quantum *) NULL) ||
cristyacd2ed22011-08-30 01:44:23 +0000545 (q == (Quantum *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000546 break;
cristybb503372010-05-27 20:51:26 +0000547 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000548 {
cristy4c08aed2011-07-01 19:47:50 +0000549 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000550 p+=GetPixelChannels(canvas_image);
551 q+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000552 }
553 if (SyncAuthenticPixels(image,exception) == MagickFalse)
554 break;
555 }
cristyb3f97ae2015-05-18 12:29:32 +0000556 pixels=(const unsigned char *) ReadBlobStream(image,length,
557 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000558 }
559 if (image->previous == (Image *) NULL)
560 {
561 status=SetImageProgress(image,LoadImageTag,4,5);
562 if (status == MagickFalse)
563 break;
564 }
565 }
566 if (image->previous == (Image *) NULL)
567 {
568 status=SetImageProgress(image,LoadImageTag,5,5);
569 if (status == MagickFalse)
570 break;
571 }
572 break;
573 }
574 case PartitionInterlace:
575 {
576 /*
577 Partition interlacing: YYYYYY..., CbCbCbCbCbCb..., CrCrCrCrCrCr...
578 */
579 AppendImageFormat("Y",image->filename);
580 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
581 if (status == MagickFalse)
582 {
583 canvas_image=DestroyImageList(canvas_image);
584 image=DestroyImageList(image);
585 return((Image *) NULL);
586 }
cristyd4297022010-09-16 22:59:09 +0000587 if (DiscardBlobBytes(image,image->offset) == MagickFalse)
588 ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
589 image->filename);
cristy3ed852e2009-09-05 21:47:34 +0000590 length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
cristybb503372010-05-27 20:51:26 +0000591 for (i=0; i < (ssize_t) scene; i++)
592 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristybd797f12015-01-24 20:42:32 +0000593 {
cristyb3f97ae2015-05-18 12:29:32 +0000594 pixels=(const unsigned char *) ReadBlobStream(image,length,
595 GetQuantumPixels(quantum_info),&count);
cristybd797f12015-01-24 20:42:32 +0000596 if (count != (ssize_t) length)
cristy3ed852e2009-09-05 21:47:34 +0000597 {
598 ThrowFileException(exception,CorruptImageError,
599 "UnexpectedEndOfFile",image->filename);
600 break;
601 }
cristybd797f12015-01-24 20:42:32 +0000602 }
cristyb3f97ae2015-05-18 12:29:32 +0000603 pixels=(const unsigned char *) ReadBlobStream(image,length,
604 GetQuantumPixels(quantum_info),&count);
cristybb503372010-05-27 20:51:26 +0000605 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000606 {
cristy21da32d2009-09-12 14:56:09 +0000607 if (count != (ssize_t) length)
608 {
609 ThrowFileException(exception,CorruptImageError,
610 "UnexpectedEndOfFile",image->filename);
611 break;
612 }
cristy3ed852e2009-09-05 21:47:34 +0000613 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
614 exception);
cristyacd2ed22011-08-30 01:44:23 +0000615 if (q == (Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000616 break;
617 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
618 quantum_info,RedQuantum,pixels,exception);
619 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
620 break;
621 if (((y-image->extract_info.y) >= 0) &&
cristybb503372010-05-27 20:51:26 +0000622 ((y-image->extract_info.y) < (ssize_t) image->rows))
cristy3ed852e2009-09-05 21:47:34 +0000623 {
624 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
625 canvas_image->columns,1,exception);
626 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
627 image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +0000628 if ((p == (const Quantum *) NULL) ||
cristyacd2ed22011-08-30 01:44:23 +0000629 (q == (Quantum *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000630 break;
cristybb503372010-05-27 20:51:26 +0000631 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000632 {
cristy4c08aed2011-07-01 19:47:50 +0000633 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000634 p+=GetPixelChannels(canvas_image);
635 q+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000636 }
637 if (SyncAuthenticPixels(image,exception) == MagickFalse)
638 break;
639 }
cristyb3f97ae2015-05-18 12:29:32 +0000640 pixels=(const unsigned char *) ReadBlobStream(image,length,
641 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000642 }
643 if (image->previous == (Image *) NULL)
644 {
645 status=SetImageProgress(image,LoadImageTag,1,5);
646 if (status == MagickFalse)
647 break;
648 }
649 (void) CloseBlob(image);
650 AppendImageFormat("Cb",image->filename);
651 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
652 if (status == MagickFalse)
653 {
654 canvas_image=DestroyImageList(canvas_image);
655 image=DestroyImageList(image);
656 return((Image *) NULL);
657 }
658 length=GetQuantumExtent(canvas_image,quantum_info,GreenQuantum);
cristybb503372010-05-27 20:51:26 +0000659 for (i=0; i < (ssize_t) scene; i++)
660 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristybd797f12015-01-24 20:42:32 +0000661 {
cristyb3f97ae2015-05-18 12:29:32 +0000662 pixels=(const unsigned char *) ReadBlobStream(image,length,
663 GetQuantumPixels(quantum_info),&count);
cristybd797f12015-01-24 20:42:32 +0000664 if (count != (ssize_t) length)
cristy3ed852e2009-09-05 21:47:34 +0000665 {
666 ThrowFileException(exception,CorruptImageError,
667 "UnexpectedEndOfFile",image->filename);
668 break;
669 }
cristybd797f12015-01-24 20:42:32 +0000670 }
cristyb3f97ae2015-05-18 12:29:32 +0000671 pixels=(const unsigned char *) ReadBlobStream(image,length,
672 GetQuantumPixels(quantum_info),&count);
cristybb503372010-05-27 20:51:26 +0000673 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000674 {
cristy21da32d2009-09-12 14:56:09 +0000675 if (count != (ssize_t) length)
676 {
677 ThrowFileException(exception,CorruptImageError,
678 "UnexpectedEndOfFile",image->filename);
679 break;
680 }
cristy3ed852e2009-09-05 21:47:34 +0000681 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
682 exception);
cristyacd2ed22011-08-30 01:44:23 +0000683 if (q == (Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000684 break;
685 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
686 quantum_info,GreenQuantum,pixels,exception);
687 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
688 break;
689 if (((y-image->extract_info.y) >= 0) &&
cristybb503372010-05-27 20:51:26 +0000690 ((y-image->extract_info.y) < (ssize_t) image->rows))
cristy3ed852e2009-09-05 21:47:34 +0000691 {
692 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
693 canvas_image->columns,1,exception);
694 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
695 image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +0000696 if ((p == (const Quantum *) NULL) ||
cristyacd2ed22011-08-30 01:44:23 +0000697 (q == (Quantum *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000698 break;
cristybb503372010-05-27 20:51:26 +0000699 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000700 {
cristy4c08aed2011-07-01 19:47:50 +0000701 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000702 p+=GetPixelChannels(canvas_image);
703 q+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000704 }
705 if (SyncAuthenticPixels(image,exception) == MagickFalse)
706 break;
707 }
cristyb3f97ae2015-05-18 12:29:32 +0000708 pixels=(const unsigned char *) ReadBlobStream(image,length,
709 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000710 }
711 if (image->previous == (Image *) NULL)
712 {
713 status=SetImageProgress(image,LoadImageTag,2,5);
714 if (status == MagickFalse)
715 break;
716 }
717 (void) CloseBlob(image);
718 AppendImageFormat("Cr",image->filename);
719 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
720 if (status == MagickFalse)
721 {
722 canvas_image=DestroyImageList(canvas_image);
723 image=DestroyImageList(image);
724 return((Image *) NULL);
725 }
726 length=GetQuantumExtent(canvas_image,quantum_info,BlueQuantum);
cristybb503372010-05-27 20:51:26 +0000727 for (i=0; i < (ssize_t) scene; i++)
728 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristybd797f12015-01-24 20:42:32 +0000729 {
cristyb3f97ae2015-05-18 12:29:32 +0000730 pixels=(const unsigned char *) ReadBlobStream(image,length,
731 GetQuantumPixels(quantum_info),&count);
cristybd797f12015-01-24 20:42:32 +0000732 if (count != (ssize_t) length)
cristy3ed852e2009-09-05 21:47:34 +0000733 {
734 ThrowFileException(exception,CorruptImageError,
735 "UnexpectedEndOfFile",image->filename);
736 break;
737 }
cristybd797f12015-01-24 20:42:32 +0000738 }
cristyb3f97ae2015-05-18 12:29:32 +0000739 pixels=(const unsigned char *) ReadBlobStream(image,length,
740 GetQuantumPixels(quantum_info),&count);
cristybb503372010-05-27 20:51:26 +0000741 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000742 {
cristy21da32d2009-09-12 14:56:09 +0000743 if (count != (ssize_t) length)
744 {
745 ThrowFileException(exception,CorruptImageError,
746 "UnexpectedEndOfFile",image->filename);
747 break;
748 }
cristy3ed852e2009-09-05 21:47:34 +0000749 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
750 exception);
cristyacd2ed22011-08-30 01:44:23 +0000751 if (q == (Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000752 break;
753 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
754 quantum_info,BlueQuantum,pixels,exception);
755 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
756 break;
757 if (((y-image->extract_info.y) >= 0) &&
cristybb503372010-05-27 20:51:26 +0000758 ((y-image->extract_info.y) < (ssize_t) image->rows))
cristy3ed852e2009-09-05 21:47:34 +0000759 {
760 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
761 canvas_image->columns,1,exception);
762 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
763 image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +0000764 if ((p == (const Quantum *) NULL) ||
cristyacd2ed22011-08-30 01:44:23 +0000765 (q == (Quantum *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000766 break;
cristybb503372010-05-27 20:51:26 +0000767 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000768 {
cristy4c08aed2011-07-01 19:47:50 +0000769 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000770 p+=GetPixelChannels(canvas_image);
771 q+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000772 }
773 if (SyncAuthenticPixels(image,exception) == MagickFalse)
774 break;
775 }
cristyb3f97ae2015-05-18 12:29:32 +0000776 pixels=(const unsigned char *) ReadBlobStream(image,length,
777 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000778 }
779 if (image->previous == (Image *) NULL)
780 {
781 status=SetImageProgress(image,LoadImageTag,3,5);
782 if (status == MagickFalse)
783 break;
784 }
cristy17f11b02014-12-20 19:37:04 +0000785 if (image->alpha_trait != UndefinedPixelTrait)
cristy3ed852e2009-09-05 21:47:34 +0000786 {
787 (void) CloseBlob(image);
788 AppendImageFormat("A",image->filename);
789 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
790 if (status == MagickFalse)
791 {
792 canvas_image=DestroyImageList(canvas_image);
793 image=DestroyImageList(image);
794 return((Image *) NULL);
795 }
796 length=GetQuantumExtent(canvas_image,quantum_info,AlphaQuantum);
cristybb503372010-05-27 20:51:26 +0000797 for (i=0; i < (ssize_t) scene; i++)
798 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristybd797f12015-01-24 20:42:32 +0000799 {
cristyb3f97ae2015-05-18 12:29:32 +0000800 pixels=(const unsigned char *) ReadBlobStream(image,length,
cristybd797f12015-01-24 20:42:32 +0000801 GetQuantumPixels(quantum_info),&count);
802 if (count != (ssize_t) length)
cristy3ed852e2009-09-05 21:47:34 +0000803 {
804 ThrowFileException(exception,CorruptImageError,
805 "UnexpectedEndOfFile",image->filename);
806 break;
807 }
cristybd797f12015-01-24 20:42:32 +0000808 }
cristyb3f97ae2015-05-18 12:29:32 +0000809 pixels=(const unsigned char *) ReadBlobStream(image,length,
810 GetQuantumPixels(quantum_info),&count);
cristybb503372010-05-27 20:51:26 +0000811 for (y=0; y < (ssize_t) image->extract_info.height; y++)
cristy3ed852e2009-09-05 21:47:34 +0000812 {
cristy21da32d2009-09-12 14:56:09 +0000813 if (count != (ssize_t) length)
814 {
815 ThrowFileException(exception,CorruptImageError,
816 "UnexpectedEndOfFile",image->filename);
817 break;
818 }
cristy3ed852e2009-09-05 21:47:34 +0000819 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
820 exception);
cristyacd2ed22011-08-30 01:44:23 +0000821 if (q == (Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000822 break;
823 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
824 quantum_info,BlueQuantum,pixels,exception);
825 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
826 break;
827 if (((y-image->extract_info.y) >= 0) &&
cristybb503372010-05-27 20:51:26 +0000828 ((y-image->extract_info.y) < (ssize_t) image->rows))
cristy3ed852e2009-09-05 21:47:34 +0000829 {
830 p=GetVirtualPixels(canvas_image,
831 canvas_image->extract_info.x,0,canvas_image->columns,1,
832 exception);
833 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
834 image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +0000835 if ((p == (const Quantum *) NULL) ||
cristyacd2ed22011-08-30 01:44:23 +0000836 (q == (Quantum *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000837 break;
cristybb503372010-05-27 20:51:26 +0000838 for (x=0; x < (ssize_t) image->columns; x++)
cristy3ed852e2009-09-05 21:47:34 +0000839 {
cristy4c08aed2011-07-01 19:47:50 +0000840 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
cristyed231572011-07-14 02:18:59 +0000841 p+=GetPixelChannels(canvas_image);
842 q+=GetPixelChannels(image);
cristy3ed852e2009-09-05 21:47:34 +0000843 }
844 if (SyncAuthenticPixels(image,exception) == MagickFalse)
845 break;
846 }
cristyb3f97ae2015-05-18 12:29:32 +0000847 pixels=(const unsigned char *) ReadBlobStream(image,length,
848 GetQuantumPixels(quantum_info),&count);
cristy3ed852e2009-09-05 21:47:34 +0000849 }
850 if (image->previous == (Image *) NULL)
851 {
852 status=SetImageProgress(image,LoadImageTag,4,5);
853 if (status == MagickFalse)
854 break;
855 }
856 }
857 if (image->previous == (Image *) NULL)
858 {
859 status=SetImageProgress(image,LoadImageTag,5,5);
860 if (status == MagickFalse)
861 break;
862 }
863 break;
864 }
865 }
866 SetQuantumImageType(image,quantum_type);
cristy3ed852e2009-09-05 21:47:34 +0000867 /*
868 Proceed to next image.
869 */
870 if (image_info->number_scenes != 0)
871 if (image->scene >= (image_info->scene+image_info->number_scenes-1))
872 break;
873 if (count == (ssize_t) length)
874 {
875 /*
876 Allocate next image structure.
877 */
cristy9950d572011-10-01 18:22:35 +0000878 AcquireNextImage(image_info,image,exception);
cristy3ed852e2009-09-05 21:47:34 +0000879 if (GetNextImageInList(image) == (Image *) NULL)
880 {
881 image=DestroyImageList(image);
882 return((Image *) NULL);
883 }
884 image=SyncNextImageInList(image);
885 status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
886 GetBlobSize(image));
887 if (status == MagickFalse)
888 break;
889 }
890 scene++;
891 } while (count == (ssize_t) length);
cristy3ed852e2009-09-05 21:47:34 +0000892 quantum_info=DestroyQuantumInfo(quantum_info);
cristy3ed852e2009-09-05 21:47:34 +0000893 canvas_image=DestroyImage(canvas_image);
894 (void) CloseBlob(image);
895 return(GetFirstImageInList(image));
896}
897
898/*
899%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
900% %
901% %
902% %
903% R e g i s t e r Y C b C r I m a g e %
904% %
905% %
906% %
907%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
908%
909% RegisterYCBCRImage() adds attributes for the YCbCr or YCbCrA image format to
910% the list of supported formats. The attributes include the image format
911% tag, a method to read and/or write the format, whether the format
912% supports the saving of more than one frame to the same file or blob,
913% whether the format supports native in-memory I/O, and a brief
914% description of the format.
915%
916% The format of the RegisterYCBCRImage method is:
917%
cristybb503372010-05-27 20:51:26 +0000918% size_t RegisterYCBCRImage(void)
cristy3ed852e2009-09-05 21:47:34 +0000919%
920*/
cristybb503372010-05-27 20:51:26 +0000921ModuleExport size_t RegisterYCBCRImage(void)
cristy3ed852e2009-09-05 21:47:34 +0000922{
923 MagickInfo
924 *entry;
925
dirk06b627a2015-04-06 18:59:17 +0000926 entry=AcquireMagickInfo("YCbCr","YCbCr","Raw Y, Cb, and Cr samples");
cristy3ed852e2009-09-05 21:47:34 +0000927 entry->decoder=(DecodeImageHandler *) ReadYCBCRImage;
928 entry->encoder=(EncodeImageHandler *) WriteYCBCRImage;
dirk08e9a112015-02-22 01:51:41 +0000929 entry->flags|=CoderRawSupportFlag;
930 entry->flags|=CoderEndianSupportFlag;
cristy3ed852e2009-09-05 21:47:34 +0000931 (void) RegisterMagickInfo(entry);
dirk06b627a2015-04-06 18:59:17 +0000932 entry=AcquireMagickInfo("YCbCr","YCbCrA","Raw Y, Cb, Cr, and alpha samples");
cristy3ed852e2009-09-05 21:47:34 +0000933 entry->decoder=(DecodeImageHandler *) ReadYCBCRImage;
934 entry->encoder=(EncodeImageHandler *) WriteYCBCRImage;
dirk08e9a112015-02-22 01:51:41 +0000935 entry->flags|=CoderRawSupportFlag;
936 entry->flags|=CoderEndianSupportFlag;
cristy3ed852e2009-09-05 21:47:34 +0000937 (void) RegisterMagickInfo(entry);
938 return(MagickImageCoderSignature);
939}
940
941/*
942%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
943% %
944% %
945% %
946% U n r e g i s t e r Y C b C r I m a g e %
947% %
948% %
949% %
950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
951%
952% UnregisterYCBCRImage() removes format registrations made by the
953% YCbCr module from the list of supported formats.
954%
955% The format of the UnregisterYCBCRImage method is:
956%
957% UnregisterYCBCRImage(void)
958%
959*/
960ModuleExport void UnregisterYCBCRImage(void)
961{
962 (void) UnregisterMagickInfo("YCbCr");
963 (void) UnregisterMagickInfo("YCbCrA");
964}
965
966/*
967%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
968% %
969% %
970% %
971% W r i t e Y C b C r I m a g e %
972% %
973% %
974% %
975%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
976%
977% WriteYCBCRImage() writes an image to a file in the YCbCr or YCbCrA
978% rasterfile format.
979%
980% The format of the WriteYCBCRImage method is:
981%
982% MagickBooleanType WriteYCBCRImage(const ImageInfo *image_info,
cristy3a37efd2011-08-28 20:31:03 +0000983% Image *image,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000984%
985% A description of each parameter follows.
986%
987% o image_info: the image info.
988%
989% o image: The image.
990%
cristy3a37efd2011-08-28 20:31:03 +0000991% o exception: return any errors or warnings in this structure.
992%
cristy3ed852e2009-09-05 21:47:34 +0000993*/
994static MagickBooleanType WriteYCBCRImage(const ImageInfo *image_info,
cristy3a37efd2011-08-28 20:31:03 +0000995 Image *image,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +0000996{
cristy3ed852e2009-09-05 21:47:34 +0000997 MagickBooleanType
998 status;
999
1000 MagickOffsetType
1001 scene;
1002
1003 QuantumInfo
1004 *quantum_info;
1005
1006 QuantumType
1007 quantum_type;
1008
cristy4c08aed2011-07-01 19:47:50 +00001009 register const Quantum
cristy3ed852e2009-09-05 21:47:34 +00001010 *p;
1011
cristy3ed852e2009-09-05 21:47:34 +00001012 size_t
1013 length;
1014
cristyc6da28e2011-04-28 01:41:35 +00001015 ssize_t
1016 count,
1017 y;
1018
cristy3ed852e2009-09-05 21:47:34 +00001019 unsigned char
1020 *pixels;
1021
1022 /*
1023 Allocate memory for pixels.
1024 */
1025 assert(image_info != (const ImageInfo *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001026 assert(image_info->signature == MagickCoreSignature);
cristy3ed852e2009-09-05 21:47:34 +00001027 assert(image != (Image *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001028 assert(image->signature == MagickCoreSignature);
cristy3ed852e2009-09-05 21:47:34 +00001029 if (image->debug != MagickFalse)
1030 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
1031 if (image_info->interlace != PartitionInterlace)
1032 {
1033 /*
1034 Open output image file.
1035 */
cristy3a37efd2011-08-28 20:31:03 +00001036 assert(exception != (ExceptionInfo *) NULL);
cristye1c94d92015-06-28 12:16:33 +00001037 assert(exception->signature == MagickCoreSignature);
cristy3a37efd2011-08-28 20:31:03 +00001038 status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
cristy3ed852e2009-09-05 21:47:34 +00001039 if (status == MagickFalse)
1040 return(status);
1041 }
1042 quantum_type=RGBQuantum;
1043 if (LocaleCompare(image_info->magick,"YCbCrA") == 0)
1044 {
1045 quantum_type=RGBAQuantum;
cristy8a46d822012-08-28 23:32:39 +00001046 image->alpha_trait=BlendPixelTrait;
cristy3ed852e2009-09-05 21:47:34 +00001047 }
1048 scene=0;
1049 do
1050 {
1051 /*
1052 Convert MIFF to YCbCr raster pixels.
1053 */
1054 if (image->colorspace != YCbCrColorspace)
cristye941a752011-10-15 01:52:48 +00001055 (void) TransformImageColorspace(image,YCbCrColorspace,exception);
cristy3ed852e2009-09-05 21:47:34 +00001056 if ((LocaleCompare(image_info->magick,"YCbCrA") == 0) &&
cristy17f11b02014-12-20 19:37:04 +00001057 (image->alpha_trait == UndefinedPixelTrait))
cristy3a37efd2011-08-28 20:31:03 +00001058 (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
cristy5f766ef2014-12-14 21:12:47 +00001059 quantum_info=AcquireQuantumInfo(image_info,image);
cristy3ed852e2009-09-05 21:47:34 +00001060 if (quantum_info == (QuantumInfo *) NULL)
1061 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
cristyb3f97ae2015-05-18 12:29:32 +00001062 pixels=(unsigned char *) GetQuantumPixels(quantum_info);
cristy3ed852e2009-09-05 21:47:34 +00001063 switch (image_info->interlace)
1064 {
1065 case NoInterlace:
1066 default:
1067 {
1068 /*
1069 No interlacing: YCbCrYCbCrYCbCrYCbCrYCbCrYCbCr...
1070 */
cristybb503372010-05-27 20:51:26 +00001071 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001072 {
cristy3a37efd2011-08-28 20:31:03 +00001073 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001074 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001075 break;
cristy4c08aed2011-07-01 19:47:50 +00001076 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001077 quantum_type,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001078 count=WriteBlob(image,length,pixels);
1079 if (count != (ssize_t) length)
1080 break;
1081 if (image->previous == (Image *) NULL)
1082 {
cristycee97112010-05-28 00:44:52 +00001083 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
1084 image->rows);
cristy3ed852e2009-09-05 21:47:34 +00001085 if (status == MagickFalse)
1086 break;
1087 }
1088 }
1089 break;
1090 }
1091 case LineInterlace:
1092 {
1093 /*
1094 Line interlacing: YYY...CbCbCb...CrCrCr...YYY...CbCbCb...CrCrCr...
1095 */
cristybb503372010-05-27 20:51:26 +00001096 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001097 {
cristy3a37efd2011-08-28 20:31:03 +00001098 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001099 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001100 break;
cristy4c08aed2011-07-01 19:47:50 +00001101 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001102 RedQuantum,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001103 count=WriteBlob(image,length,pixels);
1104 if (count != (ssize_t) length)
1105 break;
cristy4c08aed2011-07-01 19:47:50 +00001106 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001107 GreenQuantum,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001108 count=WriteBlob(image,length,pixels);
1109 if (count != (ssize_t) length)
1110 break;
cristy4c08aed2011-07-01 19:47:50 +00001111 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001112 BlueQuantum,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001113 count=WriteBlob(image,length,pixels);
1114 if (count != (ssize_t) length)
1115 break;
1116 if (quantum_type == RGBAQuantum)
1117 {
cristy4c08aed2011-07-01 19:47:50 +00001118 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001119 AlphaQuantum,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001120 count=WriteBlob(image,length,pixels);
1121 if (count != (ssize_t) length)
1122 break;
1123 }
1124 if (image->previous == (Image *) NULL)
1125 {
cristycee97112010-05-28 00:44:52 +00001126 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
1127 image->rows);
cristy3ed852e2009-09-05 21:47:34 +00001128 if (status == MagickFalse)
1129 break;
1130 }
1131 }
1132 break;
1133 }
1134 case PlaneInterlace:
1135 {
1136 /*
1137 Plane interlacing: YYYYYY...CbCbCbCbCbCb...CrCrCrCrCrCr...
1138 */
cristybb503372010-05-27 20:51:26 +00001139 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001140 {
cristy3a37efd2011-08-28 20:31:03 +00001141 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001142 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001143 break;
cristy4c08aed2011-07-01 19:47:50 +00001144 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001145 RedQuantum,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001146 count=WriteBlob(image,length,pixels);
1147 if (count != (ssize_t) length)
1148 break;
1149 }
1150 if (image->previous == (Image *) NULL)
1151 {
1152 status=SetImageProgress(image,SaveImageTag,1,5);
1153 if (status == MagickFalse)
1154 break;
1155 }
cristybb503372010-05-27 20:51:26 +00001156 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001157 {
cristy3a37efd2011-08-28 20:31:03 +00001158 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001159 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001160 break;
cristy4c08aed2011-07-01 19:47:50 +00001161 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001162 GreenQuantum,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001163 count=WriteBlob(image,length,pixels);
1164 if (count != (ssize_t) length)
1165 break;
1166 }
1167 if (image->previous == (Image *) NULL)
1168 {
1169 status=SetImageProgress(image,SaveImageTag,2,5);
1170 if (status == MagickFalse)
1171 break;
1172 }
cristybb503372010-05-27 20:51:26 +00001173 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001174 {
cristy3a37efd2011-08-28 20:31:03 +00001175 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001176 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001177 break;
cristy4c08aed2011-07-01 19:47:50 +00001178 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001179 BlueQuantum,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001180 count=WriteBlob(image,length,pixels);
1181 if (count != (ssize_t) length)
1182 break;
1183 }
1184 if (image->previous == (Image *) NULL)
1185 {
1186 status=SetImageProgress(image,SaveImageTag,3,5);
1187 if (status == MagickFalse)
1188 break;
1189 }
1190 if (quantum_type == RGBAQuantum)
1191 {
cristybb503372010-05-27 20:51:26 +00001192 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001193 {
cristy3a37efd2011-08-28 20:31:03 +00001194 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001195 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001196 break;
cristy4c08aed2011-07-01 19:47:50 +00001197 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001198 AlphaQuantum,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001199 count=WriteBlob(image,length,pixels);
1200 if (count != (ssize_t) length)
1201 break;
1202 }
1203 }
1204 if (image_info->interlace == PartitionInterlace)
1205 (void) CopyMagickString(image->filename,image_info->filename,
cristy151b66d2015-04-15 10:50:31 +00001206 MagickPathExtent);
cristy3ed852e2009-09-05 21:47:34 +00001207 if (image->previous == (Image *) NULL)
1208 {
1209 status=SetImageProgress(image,SaveImageTag,5,5);
1210 if (status == MagickFalse)
1211 break;
1212 }
1213 break;
1214 }
1215 case PartitionInterlace:
1216 {
1217 /*
1218 Partition interlacing: YYYYYY..., CbCbCbCbCbCb..., CrCrCrCrCrCr...
1219 */
1220 AppendImageFormat("Y",image->filename);
1221 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
cristy3a37efd2011-08-28 20:31:03 +00001222 AppendBinaryBlobMode,exception);
cristy3ed852e2009-09-05 21:47:34 +00001223 if (status == MagickFalse)
1224 return(status);
cristybb503372010-05-27 20:51:26 +00001225 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001226 {
cristy3a37efd2011-08-28 20:31:03 +00001227 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001228 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001229 break;
cristy4c08aed2011-07-01 19:47:50 +00001230 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001231 RedQuantum,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001232 count=WriteBlob(image,length,pixels);
1233 if (count != (ssize_t) length)
1234 break;
1235 }
1236 if (image->previous == (Image *) NULL)
1237 {
1238 status=SetImageProgress(image,SaveImageTag,1,5);
1239 if (status == MagickFalse)
1240 break;
1241 }
1242 (void) CloseBlob(image);
1243 AppendImageFormat("Cb",image->filename);
1244 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
cristy3a37efd2011-08-28 20:31:03 +00001245 AppendBinaryBlobMode,exception);
cristy3ed852e2009-09-05 21:47:34 +00001246 if (status == MagickFalse)
1247 return(status);
cristybb503372010-05-27 20:51:26 +00001248 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001249 {
cristy3a37efd2011-08-28 20:31:03 +00001250 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001251 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001252 break;
cristy4c08aed2011-07-01 19:47:50 +00001253 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001254 GreenQuantum,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001255 count=WriteBlob(image,length,pixels);
1256 if (count != (ssize_t) length)
1257 break;
1258 }
1259 if (image->previous == (Image *) NULL)
1260 {
1261 status=SetImageProgress(image,SaveImageTag,2,5);
1262 if (status == MagickFalse)
1263 break;
1264 }
1265 (void) CloseBlob(image);
1266 AppendImageFormat("Cr",image->filename);
1267 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
cristy3a37efd2011-08-28 20:31:03 +00001268 AppendBinaryBlobMode,exception);
cristy3ed852e2009-09-05 21:47:34 +00001269 if (status == MagickFalse)
1270 return(status);
cristybb503372010-05-27 20:51:26 +00001271 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001272 {
cristy3a37efd2011-08-28 20:31:03 +00001273 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001274 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001275 break;
cristy4c08aed2011-07-01 19:47:50 +00001276 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001277 BlueQuantum,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001278 count=WriteBlob(image,length,pixels);
1279 if (count != (ssize_t) length)
1280 break;
1281 }
1282 if (image->previous == (Image *) NULL)
1283 {
1284 status=SetImageProgress(image,SaveImageTag,3,5);
1285 if (status == MagickFalse)
1286 break;
1287 }
1288 if (quantum_type == RGBAQuantum)
1289 {
1290 (void) CloseBlob(image);
1291 AppendImageFormat("A",image->filename);
1292 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
cristy3a37efd2011-08-28 20:31:03 +00001293 AppendBinaryBlobMode,exception);
cristy3ed852e2009-09-05 21:47:34 +00001294 if (status == MagickFalse)
1295 return(status);
cristybb503372010-05-27 20:51:26 +00001296 for (y=0; y < (ssize_t) image->rows; y++)
cristy3ed852e2009-09-05 21:47:34 +00001297 {
cristy3a37efd2011-08-28 20:31:03 +00001298 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
cristy4c08aed2011-07-01 19:47:50 +00001299 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001300 break;
cristy4c08aed2011-07-01 19:47:50 +00001301 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
cristy3a37efd2011-08-28 20:31:03 +00001302 AlphaQuantum,pixels,exception);
cristy3ed852e2009-09-05 21:47:34 +00001303 count=WriteBlob(image,length,pixels);
1304 if (count != (ssize_t) length)
1305 break;
1306 }
1307 if (image->previous == (Image *) NULL)
1308 {
1309 status=SetImageProgress(image,SaveImageTag,4,5);
1310 if (status == MagickFalse)
1311 break;
1312 }
1313 }
1314 (void) CloseBlob(image);
1315 (void) CopyMagickString(image->filename,image_info->filename,
cristy151b66d2015-04-15 10:50:31 +00001316 MagickPathExtent);
cristy3ed852e2009-09-05 21:47:34 +00001317 if (image->previous == (Image *) NULL)
1318 {
1319 status=SetImageProgress(image,SaveImageTag,5,5);
1320 if (status == MagickFalse)
1321 break;
1322 }
1323 break;
1324 }
1325 }
1326 quantum_info=DestroyQuantumInfo(quantum_info);
1327 if (GetNextImageInList(image) == (Image *) NULL)
1328 break;
1329 image=SyncNextImageInList(image);
1330 status=SetImageProgress(image,SaveImagesTag,scene++,
1331 GetImageListLength(image));
1332 if (status == MagickFalse)
1333 break;
1334 } while (image_info->adjoin != MagickFalse);
1335 (void) CloseBlob(image);
1336 return(MagickTrue);
1337}