2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 % Read/Write RAW CMYK Image Format %
20 % Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
26 % https://www.imagemagick.org/script/license.php %
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. %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 #include "MagickCore/studio.h"
43 #include "MagickCore/blob.h"
44 #include "MagickCore/blob-private.h"
45 #include "MagickCore/cache.h"
46 #include "MagickCore/channel.h"
47 #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"
69 static MagickBooleanType
70 WriteCMYKImage(const ImageInfo *,Image *,ExceptionInfo *);
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 % R e a d C M Y K I m a g e %
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83 % ReadCMYKImage() reads an image of raw CMYK or CMYKA samples and returns it.
84 % It allocates the memory necessary for the new Image structure and returns a
85 % pointer to the new image.
87 % The format of the ReadCMYKImage method is:
89 % Image *ReadCMYKImage(const ImageInfo *image_info,
90 % ExceptionInfo *exception)
92 % A description of each parameter follows:
94 % o image_info: the image info.
96 % o exception: return any errors or warnings in this structure.
99 static Image *ReadCMYKImage(const ImageInfo *image_info,
100 ExceptionInfo *exception)
134 assert(image_info != (const ImageInfo *) NULL);
135 assert(image_info->signature == MagickCoreSignature);
136 if (image_info->debug != MagickFalse)
137 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
138 image_info->filename);
139 assert(exception != (ExceptionInfo *) NULL);
140 assert(exception->signature == MagickCoreSignature);
141 image=AcquireImage(image_info,exception);
142 if ((image->columns == 0) || (image->rows == 0))
143 ThrowReaderException(OptionError,"MustSpecifyImageSize");
144 status=SetImageExtent(image,image->columns,image->rows,exception);
145 if (status == MagickFalse)
146 return(DestroyImageList(image));
147 (void) SetImageColorspace(image,CMYKColorspace,exception);
148 if (image_info->interlace != PartitionInterlace)
150 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
151 if (status == MagickFalse)
153 image=DestroyImageList(image);
154 return((Image *) NULL);
156 if (DiscardBlobBytes(image,(MagickSizeType) image->offset) == MagickFalse)
157 ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
161 Create virtual canvas to support cropping (i.e. image.cmyk[100x100+10+20]).
163 canvas_image=CloneImage(image,image->extract_info.width,1,MagickFalse,
165 if (canvas_image == (Image *) NULL)
166 ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
167 (void) SetImageVirtualPixelMethod(canvas_image,BlackVirtualPixelMethod,
169 quantum_info=AcquireQuantumInfo(image_info,canvas_image);
170 if (quantum_info == (QuantumInfo *) NULL)
171 ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
172 quantum_type=CMYKQuantum;
173 if (LocaleCompare(image_info->magick,"CMYKA") == 0)
175 quantum_type=CMYKAQuantum;
176 image->alpha_trait=BlendPixelTrait;
178 pixels=(const unsigned char *) NULL;
179 if (image_info->number_scenes != 0)
180 while (image->scene < image_info->scene)
186 length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
187 for (y=0; y < (ssize_t) image->rows; y++)
189 pixels=(const unsigned char *) ReadBlobStream(image,length,
190 GetQuantumPixels(quantum_info),&count);
191 if (count != (ssize_t) length)
202 Read pixels to virtual canvas image then push to image.
204 if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
205 if (image->scene >= (image_info->scene+image_info->number_scenes-1))
207 status=SetImageExtent(image,image->columns,image->rows,exception);
208 if (status == MagickFalse)
210 if (SetImageColorspace(image,CMYKColorspace,exception) == MagickFalse)
212 switch (image_info->interlace)
218 No interlacing: CMYKCMYKCMYKCMYKCMYKCMYK...
222 length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
223 pixels=(const unsigned char *) ReadBlobStream(image,length,
224 GetQuantumPixels(quantum_info),&count);
225 if (count != (ssize_t) length)
228 for (y=0; y < (ssize_t) image->extract_info.height; y++)
230 register const Quantum
239 if (count != (ssize_t) length)
242 ThrowFileException(exception,CorruptImageError,
243 "UnexpectedEndOfFile",image->filename);
246 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
248 if (q == (Quantum *) NULL)
250 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
251 quantum_info,quantum_type,pixels,exception);
252 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
254 if (((y-image->extract_info.y) >= 0) &&
255 ((y-image->extract_info.y) < (ssize_t) image->rows))
257 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
258 canvas_image->columns,1,exception);
259 q=QueueAuthenticPixels(image,0,y-image->extract_info.y,
260 image->columns,1,exception);
261 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
263 for (x=0; x < (ssize_t) image->columns; x++)
265 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
266 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
267 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
268 SetPixelBlack(image,GetPixelBlack(canvas_image,p),q);
269 SetPixelAlpha(image,OpaqueAlpha,q);
270 if (image->alpha_trait != UndefinedPixelTrait)
271 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
272 p+=GetPixelChannels(canvas_image);
273 q+=GetPixelChannels(image);
275 if (SyncAuthenticPixels(image,exception) == MagickFalse)
278 if (image->previous == (Image *) NULL)
280 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
282 if (status == MagickFalse)
285 pixels=(const unsigned char *) ReadBlobStream(image,length,
286 GetQuantumPixels(quantum_info),&count);
287 if (count != (ssize_t) length)
305 Line interlacing: CCC...MMM...YYY...KKK...CCC...MMM...YYY...KKK...
309 length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum);
310 pixels=(const unsigned char *) ReadBlobStream(image,length,
311 GetQuantumPixels(quantum_info),&count);
312 if (count != (ssize_t) length)
315 for (y=0; y < (ssize_t) image->extract_info.height; y++)
317 register const Quantum
326 if (count != (ssize_t) length)
329 ThrowFileException(exception,CorruptImageError,
330 "UnexpectedEndOfFile",image->filename);
333 for (i=0; i < (ssize_t) (image->alpha_trait != UndefinedPixelTrait ? 5 : 4); i++)
335 quantum_type=quantum_types[i];
336 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
338 if (q == (Quantum *) NULL)
340 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
341 quantum_info,quantum_type,pixels,exception);
342 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
344 if (((y-image->extract_info.y) >= 0) &&
345 ((y-image->extract_info.y) < (ssize_t) image->rows))
347 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,
348 0,canvas_image->columns,1,exception);
349 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
350 image->columns,1,exception);
351 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
353 for (x=0; x < (ssize_t) image->columns; x++)
355 switch (quantum_type)
359 SetPixelCyan(image,GetPixelCyan(canvas_image,p),q);
364 SetPixelMagenta(image,GetPixelMagenta(canvas_image,p),q);
369 SetPixelYellow(image,GetPixelYellow(canvas_image,p),q);
374 SetPixelBlack(image,GetPixelBlack(canvas_image,p),q);
379 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
385 p+=GetPixelChannels(canvas_image);
386 q+=GetPixelChannels(image);
388 if (SyncAuthenticPixels(image,exception) == MagickFalse)
391 pixels=(const unsigned char *) ReadBlobStream(image,length,
392 GetQuantumPixels(quantum_info),&count);
393 if (count != (ssize_t) length)
396 if (image->previous == (Image *) NULL)
398 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
400 if (status == MagickFalse)
409 Plane interlacing: CCCCCC...MMMMMM...YYYYYY...KKKKKK...
413 length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum);
414 pixels=(const unsigned char *) ReadBlobStream(image,length,
415 GetQuantumPixels(quantum_info),&count);
416 if (count != (ssize_t) length)
419 for (y=0; y < (ssize_t) image->extract_info.height; y++)
421 register const Quantum
430 if (count != (ssize_t) length)
433 ThrowFileException(exception,CorruptImageError,
434 "UnexpectedEndOfFile",image->filename);
437 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
439 if (q == (Quantum *) NULL)
441 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
442 quantum_info,CyanQuantum,pixels,exception);
443 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
445 if (((y-image->extract_info.y) >= 0) &&
446 ((y-image->extract_info.y) < (ssize_t) image->rows))
448 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
449 canvas_image->columns,1,exception);
450 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
451 image->columns,1,exception);
452 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
454 for (x=0; x < (ssize_t) image->columns; x++)
456 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
457 p+=GetPixelChannels(canvas_image);
458 q+=GetPixelChannels(image);
460 if (SyncAuthenticPixels(image,exception) == MagickFalse)
463 pixels=(const unsigned char *) ReadBlobStream(image,length,
464 GetQuantumPixels(quantum_info),&count);
465 if (count != (ssize_t) length)
468 if (image->previous == (Image *) NULL)
470 status=SetImageProgress(image,LoadImageTag,1,6);
471 if (status == MagickFalse)
474 for (y=0; y < (ssize_t) image->extract_info.height; y++)
476 register const Quantum
485 if (count != (ssize_t) length)
488 ThrowFileException(exception,CorruptImageError,
489 "UnexpectedEndOfFile",image->filename);
492 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
494 if (q == (Quantum *) NULL)
496 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
497 quantum_info,MagentaQuantum,pixels,exception);
498 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
500 if (((y-image->extract_info.y) >= 0) &&
501 ((y-image->extract_info.y) < (ssize_t) image->rows))
503 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
504 canvas_image->columns,1,exception);
505 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
506 image->columns,1,exception);
507 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
509 for (x=0; x < (ssize_t) image->columns; x++)
511 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
512 p+=GetPixelChannels(canvas_image);
513 q+=GetPixelChannels(image);
515 if (SyncAuthenticPixels(image,exception) == MagickFalse)
518 pixels=(const unsigned char *) ReadBlobStream(image,length,
519 GetQuantumPixels(quantum_info),&count);
520 if (count != (ssize_t) length)
523 if (image->previous == (Image *) NULL)
525 status=SetImageProgress(image,LoadImageTag,2,6);
526 if (status == MagickFalse)
529 for (y=0; y < (ssize_t) image->extract_info.height; y++)
531 register const Quantum
540 if (count != (ssize_t) length)
543 ThrowFileException(exception,CorruptImageError,
544 "UnexpectedEndOfFile",image->filename);
547 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
549 if (q == (Quantum *) NULL)
551 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
552 quantum_info,YellowQuantum,pixels,exception);
553 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
555 if (((y-image->extract_info.y) >= 0) &&
556 ((y-image->extract_info.y) < (ssize_t) image->rows))
558 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
559 canvas_image->columns,1,exception);
560 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
561 image->columns,1,exception);
562 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
564 for (x=0; x < (ssize_t) image->columns; x++)
566 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
567 p+=GetPixelChannels(canvas_image);
568 q+=GetPixelChannels(image);
570 if (SyncAuthenticPixels(image,exception) == MagickFalse)
573 pixels=(const unsigned char *) ReadBlobStream(image,length,
574 GetQuantumPixels(quantum_info),&count);
575 if (count != (ssize_t) length)
578 if (image->previous == (Image *) NULL)
580 status=SetImageProgress(image,LoadImageTag,3,6);
581 if (status == MagickFalse)
584 for (y=0; y < (ssize_t) image->extract_info.height; y++)
586 register const Quantum
595 if (count != (ssize_t) length)
598 ThrowFileException(exception,CorruptImageError,
599 "UnexpectedEndOfFile",image->filename);
602 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
604 if (q == (Quantum *) NULL)
606 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
607 quantum_info,BlackQuantum,pixels,exception);
608 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
610 if (((y-image->extract_info.y) >= 0) &&
611 ((y-image->extract_info.y) < (ssize_t) image->rows))
613 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
614 canvas_image->columns,1,exception);
615 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
616 image->columns,1,exception);
617 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
619 for (x=0; x < (ssize_t) image->columns; x++)
621 SetPixelBlack(image,GetPixelBlack(canvas_image,p),q);
622 p+=GetPixelChannels(canvas_image);
623 q+=GetPixelChannels(image);
625 if (SyncAuthenticPixels(image,exception) == MagickFalse)
628 pixels=(const unsigned char *) ReadBlobStream(image,length,
629 GetQuantumPixels(quantum_info),&count);
630 if (count != (ssize_t) length)
633 if (image->previous == (Image *) NULL)
635 status=SetImageProgress(image,LoadImageTag,4,6);
636 if (status == MagickFalse)
639 if (image->alpha_trait != UndefinedPixelTrait)
641 for (y=0; y < (ssize_t) image->extract_info.height; y++)
643 register const Quantum
652 if (count != (ssize_t) length)
655 ThrowFileException(exception,CorruptImageError,
656 "UnexpectedEndOfFile",image->filename);
659 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
661 if (q == (Quantum *) NULL)
663 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
664 quantum_info,AlphaQuantum,pixels,exception);
665 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
667 if (((y-image->extract_info.y) >= 0) &&
668 ((y-image->extract_info.y) < (ssize_t) image->rows))
670 p=GetVirtualPixels(canvas_image,
671 canvas_image->extract_info.x,0,canvas_image->columns,1,
673 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
674 image->columns,1,exception);
675 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
677 for (x=0; x < (ssize_t) image->columns; x++)
679 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
680 p+=GetPixelChannels(canvas_image);
681 q+=GetPixelChannels(image);
683 if (SyncAuthenticPixels(image,exception) == MagickFalse)
686 pixels=(const unsigned char *) ReadBlobStream(image,length,
687 GetQuantumPixels(quantum_info),&count);
688 if (count != (ssize_t) length)
691 if (image->previous == (Image *) NULL)
693 status=SetImageProgress(image,LoadImageTag,5,6);
694 if (status == MagickFalse)
698 if (image->previous == (Image *) NULL)
700 status=SetImageProgress(image,LoadImageTag,6,6);
701 if (status == MagickFalse)
706 case PartitionInterlace:
709 Partition interlacing: CCCCCC..., MMMMMM..., YYYYYY..., KKKKKK...
711 AppendImageFormat("C",image->filename);
712 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
713 if (status == MagickFalse)
715 canvas_image=DestroyImageList(canvas_image);
716 image=DestroyImageList(image);
717 return((Image *) NULL);
719 if (DiscardBlobBytes(image,(MagickSizeType) image->offset) == MagickFalse)
720 ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
722 length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum);
723 for (i=0; i < (ssize_t) scene; i++)
724 for (y=0; y < (ssize_t) image->extract_info.height; y++)
726 pixels=(const unsigned char *) ReadBlobStream(image,length,
727 GetQuantumPixels(quantum_info),&count);
728 if (count != (ssize_t) length)
731 ThrowFileException(exception,CorruptImageError,
732 "UnexpectedEndOfFile",image->filename);
736 pixels=(const unsigned char *) ReadBlobStream(image,length,
737 GetQuantumPixels(quantum_info),&count);
738 if (count != (ssize_t) length)
740 for (y=0; y < (ssize_t) image->extract_info.height; y++)
742 register const Quantum
751 if (count != (ssize_t) length)
754 ThrowFileException(exception,CorruptImageError,
755 "UnexpectedEndOfFile",image->filename);
758 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
760 if (q == (Quantum *) NULL)
762 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
763 quantum_info,CyanQuantum,pixels,exception);
764 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
766 if (((y-image->extract_info.y) >= 0) &&
767 ((y-image->extract_info.y) < (ssize_t) image->rows))
769 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
770 canvas_image->columns,1,exception);
771 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
772 image->columns,1,exception);
773 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
775 for (x=0; x < (ssize_t) image->columns; x++)
777 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
778 p+=GetPixelChannels(canvas_image);
779 q+=GetPixelChannels(image);
781 if (SyncAuthenticPixels(image,exception) == MagickFalse)
784 pixels=(const unsigned char *) ReadBlobStream(image,length,
785 GetQuantumPixels(quantum_info),&count);
786 if (count != (ssize_t) length)
789 if (image->previous == (Image *) NULL)
791 status=SetImageProgress(image,LoadImageTag,1,5);
792 if (status == MagickFalse)
795 (void) CloseBlob(image);
796 AppendImageFormat("M",image->filename);
797 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
798 if (status == MagickFalse)
800 canvas_image=DestroyImageList(canvas_image);
801 image=DestroyImageList(image);
802 return((Image *) NULL);
804 length=GetQuantumExtent(canvas_image,quantum_info,MagentaQuantum);
805 for (i=0; i < (ssize_t) scene; i++)
806 for (y=0; y < (ssize_t) image->extract_info.height; y++)
808 pixels=(const unsigned char *) ReadBlobStream(image,length,
809 GetQuantumPixels(quantum_info),&count);
810 if (count != (ssize_t) length)
813 ThrowFileException(exception,CorruptImageError,
814 "UnexpectedEndOfFile",image->filename);
818 pixels=(const unsigned char *) ReadBlobStream(image,length,
819 GetQuantumPixels(quantum_info),&count);
820 if (count != (ssize_t) length)
822 for (y=0; y < (ssize_t) image->extract_info.height; y++)
824 register const Quantum
833 if (count != (ssize_t) length)
836 ThrowFileException(exception,CorruptImageError,
837 "UnexpectedEndOfFile",image->filename);
840 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
842 if (q == (Quantum *) NULL)
844 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
845 quantum_info,MagentaQuantum,pixels,exception);
846 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
848 if (((y-image->extract_info.y) >= 0) &&
849 ((y-image->extract_info.y) < (ssize_t) image->rows))
851 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
852 canvas_image->columns,1,exception);
853 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
854 image->columns,1,exception);
855 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
857 for (x=0; x < (ssize_t) image->columns; x++)
859 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
860 p+=GetPixelChannels(canvas_image);
861 q+=GetPixelChannels(image);
863 if (SyncAuthenticPixels(image,exception) == MagickFalse)
866 pixels=(const unsigned char *) ReadBlobStream(image,length,
867 GetQuantumPixels(quantum_info),&count);
868 if (count != (ssize_t) length)
871 if (image->previous == (Image *) NULL)
873 status=SetImageProgress(image,LoadImageTag,2,5);
874 if (status == MagickFalse)
877 (void) CloseBlob(image);
878 AppendImageFormat("Y",image->filename);
879 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
880 if (status == MagickFalse)
882 canvas_image=DestroyImageList(canvas_image);
883 image=DestroyImageList(image);
884 return((Image *) NULL);
886 length=GetQuantumExtent(canvas_image,quantum_info,YellowQuantum);
887 for (i=0; i < (ssize_t) scene; i++)
888 for (y=0; y < (ssize_t) image->extract_info.height; y++)
890 pixels=(const unsigned char *) ReadBlobStream(image,length,
891 GetQuantumPixels(quantum_info),&count);
892 if (count != (ssize_t) length)
895 ThrowFileException(exception,CorruptImageError,
896 "UnexpectedEndOfFile",image->filename);
900 pixels=(const unsigned char *) ReadBlobStream(image,length,
901 GetQuantumPixels(quantum_info),&count);
902 if (count != (ssize_t) length)
904 for (y=0; y < (ssize_t) image->extract_info.height; y++)
906 register const Quantum
915 if (count != (ssize_t) length)
918 ThrowFileException(exception,CorruptImageError,
919 "UnexpectedEndOfFile",image->filename);
922 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
924 if (q == (Quantum *) NULL)
926 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
927 quantum_info,YellowQuantum,pixels,exception);
928 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
930 if (((y-image->extract_info.y) >= 0) &&
931 ((y-image->extract_info.y) < (ssize_t) image->rows))
933 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
934 canvas_image->columns,1,exception);
935 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
936 image->columns,1,exception);
937 if ((p == (const Quantum *) NULL) ||
938 (q == (Quantum *) NULL))
940 for (x=0; x < (ssize_t) image->columns; x++)
942 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
943 p+=GetPixelChannels(canvas_image);
944 q+=GetPixelChannels(image);
946 if (SyncAuthenticPixels(image,exception) == MagickFalse)
949 pixels=(const unsigned char *) ReadBlobStream(image,length,
950 GetQuantumPixels(quantum_info),&count);
951 if (count != (ssize_t) length)
954 if (image->previous == (Image *) NULL)
956 status=SetImageProgress(image,LoadImageTag,3,5);
957 if (status == MagickFalse)
960 (void) CloseBlob(image);
961 AppendImageFormat("K",image->filename);
962 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
963 if (status == MagickFalse)
965 canvas_image=DestroyImageList(canvas_image);
966 image=DestroyImageList(image);
967 return((Image *) NULL);
969 length=GetQuantumExtent(canvas_image,quantum_info,BlackQuantum);
970 for (i=0; i < (ssize_t) scene; i++)
971 for (y=0; y < (ssize_t) image->extract_info.height; y++)
973 pixels=(const unsigned char *) ReadBlobStream(image,length,
974 GetQuantumPixels(quantum_info),&count);
975 if (count != (ssize_t) length)
978 ThrowFileException(exception,CorruptImageError,
979 "UnexpectedEndOfFile",image->filename);
983 pixels=(const unsigned char *) ReadBlobStream(image,length,
984 GetQuantumPixels(quantum_info),&count);
985 if (count != (ssize_t) length)
987 for (y=0; y < (ssize_t) image->extract_info.height; y++)
989 register const Quantum
998 if (count != (ssize_t) length)
1001 ThrowFileException(exception,CorruptImageError,
1002 "UnexpectedEndOfFile",image->filename);
1005 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
1007 if (q == (Quantum *) NULL)
1009 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
1010 quantum_info,BlackQuantum,pixels,exception);
1011 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
1013 if (((y-image->extract_info.y) >= 0) &&
1014 ((y-image->extract_info.y) < (ssize_t) image->rows))
1016 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
1017 canvas_image->columns,1,exception);
1018 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
1019 image->columns,1,exception);
1020 if ((p == (const Quantum *) NULL) ||
1021 (q == (Quantum *) NULL))
1023 for (x=0; x < (ssize_t) image->columns; x++)
1025 SetPixelBlack(image,GetPixelBlack(canvas_image,p),q);
1026 p+=GetPixelChannels(canvas_image);
1027 q+=GetPixelChannels(image);
1029 if (SyncAuthenticPixels(image,exception) == MagickFalse)
1032 pixels=(const unsigned char *) ReadBlobStream(image,length,
1033 GetQuantumPixels(quantum_info),&count);
1034 if (count != (ssize_t) length)
1037 if (image->previous == (Image *) NULL)
1039 status=SetImageProgress(image,LoadImageTag,3,5);
1040 if (status == MagickFalse)
1043 if (image->alpha_trait != UndefinedPixelTrait)
1045 (void) CloseBlob(image);
1046 AppendImageFormat("A",image->filename);
1047 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
1048 if (status == MagickFalse)
1050 canvas_image=DestroyImageList(canvas_image);
1051 image=DestroyImageList(image);
1052 return((Image *) NULL);
1054 length=GetQuantumExtent(canvas_image,quantum_info,AlphaQuantum);
1055 for (i=0; i < (ssize_t) scene; i++)
1056 for (y=0; y < (ssize_t) image->extract_info.height; y++)
1058 pixels=(const unsigned char *) ReadBlobStream(image,length,
1059 GetQuantumPixels(quantum_info),&count);
1060 if (count != (ssize_t) length)
1063 ThrowFileException(exception,CorruptImageError,
1064 "UnexpectedEndOfFile",image->filename);
1068 pixels=(const unsigned char *) ReadBlobStream(image,length,
1069 GetQuantumPixels(quantum_info),&count);
1070 if (count != (ssize_t) length)
1072 for (y=0; y < (ssize_t) image->extract_info.height; y++)
1074 register const Quantum
1083 if (count != (ssize_t) length)
1086 ThrowFileException(exception,CorruptImageError,
1087 "UnexpectedEndOfFile",image->filename);
1090 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
1092 if (q == (Quantum *) NULL)
1094 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
1095 quantum_info,YellowQuantum,pixels,exception);
1096 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
1098 if (((y-image->extract_info.y) >= 0) &&
1099 ((y-image->extract_info.y) < (ssize_t) image->rows))
1101 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,
1102 0,canvas_image->columns,1,exception);
1103 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
1104 image->columns,1,exception);
1105 if ((p == (const Quantum *) NULL) ||
1106 (q == (Quantum *) NULL))
1108 for (x=0; x < (ssize_t) image->columns; x++)
1110 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
1111 p+=GetPixelChannels(canvas_image);
1112 q+=GetPixelChannels(image);
1114 if (SyncAuthenticPixels(image,exception) == MagickFalse)
1117 pixels=(const unsigned char *) ReadBlobStream(image,length,
1118 GetQuantumPixels(quantum_info),&count);
1119 if (count != (ssize_t) length)
1122 if (image->previous == (Image *) NULL)
1124 status=SetImageProgress(image,LoadImageTag,4,5);
1125 if (status == MagickFalse)
1129 if (image->previous == (Image *) NULL)
1131 status=SetImageProgress(image,LoadImageTag,5,5);
1132 if (status == MagickFalse)
1138 SetQuantumImageType(image,quantum_type);
1140 Proceed to next image.
1142 if (image_info->number_scenes != 0)
1143 if (image->scene >= (image_info->scene+image_info->number_scenes-1))
1145 if (count == (ssize_t) length)
1148 Allocate next image structure.
1150 AcquireNextImage(image_info,image,exception);
1151 if (GetNextImageInList(image) == (Image *) NULL)
1153 image=DestroyImageList(image);
1154 return((Image *) NULL);
1156 image=SyncNextImageInList(image);
1157 status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
1158 GetBlobSize(image));
1159 if (status == MagickFalse)
1163 } while (count == (ssize_t) length);
1164 quantum_info=DestroyQuantumInfo(quantum_info);
1165 canvas_image=DestroyImage(canvas_image);
1166 (void) CloseBlob(image);
1167 if (status == MagickFalse)
1168 return(DestroyImageList(image));
1169 return(GetFirstImageInList(image));
1173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1177 % R e g i s t e r C M Y K I m a g e %
1181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1183 % RegisterCMYKImage() adds attributes for the CMYK image format to
1184 % the list of supported formats. The attributes include the image format
1185 % tag, a method to read and/or write the format, whether the format
1186 % supports the saving of more than one frame to the same file or blob,
1187 % whether the format supports native in-memory I/O, and a brief
1188 % description of the format.
1190 % The format of the RegisterCMYKImage method is:
1192 % size_t RegisterCMYKImage(void)
1195 ModuleExport size_t RegisterCMYKImage(void)
1200 entry=AcquireMagickInfo("CMYK","CMYK",
1201 "Raw cyan, magenta, yellow, and black samples");
1202 entry->decoder=(DecodeImageHandler *) ReadCMYKImage;
1203 entry->encoder=(EncodeImageHandler *) WriteCMYKImage;
1204 entry->flags|=CoderRawSupportFlag;
1205 entry->flags|=CoderEndianSupportFlag;
1206 (void) RegisterMagickInfo(entry);
1207 entry=AcquireMagickInfo("CMYK","CMYKA",
1208 "Raw cyan, magenta, yellow, black, and alpha samples");
1209 entry->decoder=(DecodeImageHandler *) ReadCMYKImage;
1210 entry->encoder=(EncodeImageHandler *) WriteCMYKImage;
1211 entry->flags|=CoderRawSupportFlag;
1212 entry->flags|=CoderEndianSupportFlag;
1213 (void) RegisterMagickInfo(entry);
1214 return(MagickImageCoderSignature);
1218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1222 % U n r e g i s t e r C M Y K I m a g e %
1226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1228 % UnregisterCMYKImage() removes format registrations made by the
1229 % CMYK module from the list of supported formats.
1231 % The format of the UnregisterCMYKImage method is:
1233 % UnregisterCMYKImage(void)
1236 ModuleExport void UnregisterCMYKImage(void)
1238 (void) UnregisterMagickInfo("CMYK");
1239 (void) UnregisterMagickInfo("CMYKA");
1243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1247 % W r i t e C M Y K I m a g e %
1251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1253 % WriteCMYKImage() writes an image to a file in cyan, magenta, yellow, and
1254 % black,rasterfile format.
1256 % The format of the WriteCMYKImage method is:
1258 % MagickBooleanType WriteCMYKImage(const ImageInfo *image_info,
1259 % Image *image,ExceptionInfo *exception)
1261 % A description of each parameter follows.
1263 % o image_info: the image info.
1265 % o image: The image.
1267 % o exception: return any errors or warnings in this structure.
1270 static MagickBooleanType WriteCMYKImage(const ImageInfo *image_info,
1271 Image *image,ExceptionInfo *exception)
1296 Allocate memory for pixels.
1298 assert(image_info != (const ImageInfo *) NULL);
1299 assert(image_info->signature == MagickCoreSignature);
1300 assert(image != (Image *) NULL);
1301 assert(image->signature == MagickCoreSignature);
1302 if (image->debug != MagickFalse)
1303 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
1304 if (image_info->interlace != PartitionInterlace)
1307 Open output image file.
1309 status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
1310 if (status == MagickFalse)
1317 Convert MIFF to CMYK raster pixels.
1319 if (image->colorspace != CMYKColorspace)
1320 (void) TransformImageColorspace(image,CMYKColorspace,exception);
1321 quantum_type=CMYKQuantum;
1322 if (LocaleCompare(image_info->magick,"CMYKA") == 0)
1324 quantum_type=CMYKAQuantum;
1325 if (image->alpha_trait == UndefinedPixelTrait)
1326 (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
1328 quantum_info=AcquireQuantumInfo(image_info,image);
1329 if (quantum_info == (QuantumInfo *) NULL)
1330 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
1331 pixels=(unsigned char *) GetQuantumPixels(quantum_info);
1332 switch (image_info->interlace)
1338 No interlacing: CMYKCMYKCMYKCMYKCMYKCMYK...
1340 for (y=0; y < (ssize_t) image->rows; y++)
1342 register const Quantum
1345 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1346 if (p == (const Quantum *) NULL)
1348 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1349 quantum_type,pixels,exception);
1350 count=WriteBlob(image,length,pixels);
1351 if (count != (ssize_t) length)
1353 if (image->previous == (Image *) NULL)
1355 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
1357 if (status == MagickFalse)
1366 Line interlacing: CCC...MMM...YYY...KKK...CCC...MMM...YYY...KKK...
1368 for (y=0; y < (ssize_t) image->rows; y++)
1370 register const Quantum
1373 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1374 if (p == (const Quantum *) NULL)
1376 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1377 CyanQuantum,pixels,exception);
1378 count=WriteBlob(image,length,pixels);
1379 if (count != (ssize_t) length)
1381 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1382 MagentaQuantum,pixels,exception);
1383 count=WriteBlob(image,length,pixels);
1384 if (count != (ssize_t) length)
1386 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1387 YellowQuantum,pixels,exception);
1388 count=WriteBlob(image,length,pixels);
1389 if (count != (ssize_t) length)
1391 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1392 BlackQuantum,pixels,exception);
1393 count=WriteBlob(image,length,pixels);
1394 if (count != (ssize_t) length)
1396 if (quantum_type == CMYKAQuantum)
1398 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1399 AlphaQuantum,pixels,exception);
1400 count=WriteBlob(image,length,pixels);
1401 if (count != (ssize_t) length)
1404 if (image->previous == (Image *) NULL)
1406 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
1408 if (status == MagickFalse)
1414 case PlaneInterlace:
1417 Plane interlacing: CCCCCC...MMMMMM...YYYYYY...KKKKKK...
1419 for (y=0; y < (ssize_t) image->rows; y++)
1421 register const Quantum
1424 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1425 if (p == (const Quantum *) NULL)
1427 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1428 CyanQuantum,pixels,exception);
1429 count=WriteBlob(image,length,pixels);
1430 if (count != (ssize_t) length)
1433 if (image->previous == (Image *) NULL)
1435 status=SetImageProgress(image,SaveImageTag,1,6);
1436 if (status == MagickFalse)
1439 for (y=0; y < (ssize_t) image->rows; y++)
1441 register const Quantum
1444 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1445 if (p == (const Quantum *) NULL)
1447 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1448 MagentaQuantum,pixels,exception);
1449 count=WriteBlob(image,length,pixels);
1450 if (count != (ssize_t) length)
1453 if (image->previous == (Image *) NULL)
1455 status=SetImageProgress(image,SaveImageTag,2,6);
1456 if (status == MagickFalse)
1459 for (y=0; y < (ssize_t) image->rows; y++)
1461 register const Quantum
1464 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1465 if (p == (const Quantum *) NULL)
1467 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1468 YellowQuantum,pixels,exception);
1469 count=WriteBlob(image,length,pixels);
1470 if (count != (ssize_t) length)
1473 if (image->previous == (Image *) NULL)
1475 status=SetImageProgress(image,SaveImageTag,3,6);
1476 if (status == MagickFalse)
1479 for (y=0; y < (ssize_t) image->rows; y++)
1481 register const Quantum
1484 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1485 if (p == (const Quantum *) NULL)
1487 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1488 BlackQuantum,pixels,exception);
1489 count=WriteBlob(image,length,pixels);
1490 if (count != (ssize_t) length)
1493 if (image->previous == (Image *) NULL)
1495 status=SetImageProgress(image,SaveImageTag,4,6);
1496 if (status == MagickFalse)
1499 if (quantum_type == CMYKAQuantum)
1501 for (y=0; y < (ssize_t) image->rows; y++)
1503 register const Quantum
1506 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1507 if (p == (const Quantum *) NULL)
1509 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1510 AlphaQuantum,pixels,exception);
1511 count=WriteBlob(image,length,pixels);
1512 if (count != (ssize_t) length)
1515 if (image->previous == (Image *) NULL)
1517 status=SetImageProgress(image,SaveImageTag,5,6);
1518 if (status == MagickFalse)
1522 if (image_info->interlace == PartitionInterlace)
1523 (void) CopyMagickString(image->filename,image_info->filename,
1525 if (image->previous == (Image *) NULL)
1527 status=SetImageProgress(image,SaveImageTag,6,6);
1528 if (status == MagickFalse)
1533 case PartitionInterlace:
1536 Partition interlacing: CCCCCC..., MMMMMM..., YYYYYY..., KKKKKK...
1538 AppendImageFormat("C",image->filename);
1539 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
1540 AppendBinaryBlobMode,exception);
1541 if (status == MagickFalse)
1543 for (y=0; y < (ssize_t) image->rows; y++)
1545 register const Quantum
1548 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1549 if (p == (const Quantum *) NULL)
1551 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1552 CyanQuantum,pixels,exception);
1553 count=WriteBlob(image,length,pixels);
1554 if (count != (ssize_t) length)
1557 if (image->previous == (Image *) NULL)
1559 status=SetImageProgress(image,SaveImageTag,1,6);
1560 if (status == MagickFalse)
1563 (void) CloseBlob(image);
1564 AppendImageFormat("M",image->filename);
1565 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
1566 AppendBinaryBlobMode,exception);
1567 if (status == MagickFalse)
1569 for (y=0; y < (ssize_t) image->rows; y++)
1571 register const Quantum
1574 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1575 if (p == (const Quantum *) NULL)
1577 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1578 MagentaQuantum,pixels,exception);
1579 count=WriteBlob(image,length,pixels);
1580 if (count != (ssize_t) length)
1583 if (image->previous == (Image *) NULL)
1585 status=SetImageProgress(image,SaveImageTag,2,6);
1586 if (status == MagickFalse)
1589 (void) CloseBlob(image);
1590 AppendImageFormat("Y",image->filename);
1591 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
1592 AppendBinaryBlobMode,exception);
1593 if (status == MagickFalse)
1595 for (y=0; y < (ssize_t) image->rows; y++)
1597 register const Quantum
1600 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1601 if (p == (const Quantum *) NULL)
1603 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1604 YellowQuantum,pixels,exception);
1605 count=WriteBlob(image,length,pixels);
1606 if (count != (ssize_t) length)
1609 if (image->previous == (Image *) NULL)
1611 status=SetImageProgress(image,SaveImageTag,3,6);
1612 if (status == MagickFalse)
1615 (void) CloseBlob(image);
1616 AppendImageFormat("K",image->filename);
1617 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
1618 AppendBinaryBlobMode,exception);
1619 if (status == MagickFalse)
1621 for (y=0; y < (ssize_t) image->rows; y++)
1623 register const Quantum
1626 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1627 if (p == (const Quantum *) NULL)
1629 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1630 BlackQuantum,pixels,exception);
1631 count=WriteBlob(image,length,pixels);
1632 if (count != (ssize_t) length)
1635 if (image->previous == (Image *) NULL)
1637 status=SetImageProgress(image,SaveImageTag,4,6);
1638 if (status == MagickFalse)
1641 if (quantum_type == CMYKAQuantum)
1643 (void) CloseBlob(image);
1644 AppendImageFormat("A",image->filename);
1645 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
1646 AppendBinaryBlobMode,exception);
1647 if (status == MagickFalse)
1649 for (y=0; y < (ssize_t) image->rows; y++)
1651 register const Quantum
1654 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1655 if (p == (const Quantum *) NULL)
1657 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1658 AlphaQuantum,pixels,exception);
1659 count=WriteBlob(image,length,pixels);
1660 if (count != (ssize_t) length)
1663 if (image->previous == (Image *) NULL)
1665 status=SetImageProgress(image,SaveImageTag,5,6);
1666 if (status == MagickFalse)
1670 (void) CloseBlob(image);
1671 (void) CopyMagickString(image->filename,image_info->filename,
1673 if (image->previous == (Image *) NULL)
1675 status=SetImageProgress(image,SaveImageTag,6,6);
1676 if (status == MagickFalse)
1682 quantum_info=DestroyQuantumInfo(quantum_info);
1683 if (GetNextImageInList(image) == (Image *) NULL)
1685 image=SyncNextImageInList(image);
1686 status=SetImageProgress(image,SaveImagesTag,scene++,
1687 GetImageListLength(image));
1688 if (status == MagickFalse)
1690 } while (image_info->adjoin != MagickFalse);
1691 (void) CloseBlob(image);