2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 % Read/Write RAW CMYK Image Format %
20 % Copyright 1999-2017 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 SetImageColorspace(image,CMYKColorspace,exception);
145 if (image_info->interlace != PartitionInterlace)
147 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
148 if (status == MagickFalse)
150 image=DestroyImageList(image);
151 return((Image *) NULL);
153 if (DiscardBlobBytes(image,image->offset) == MagickFalse)
154 ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
158 Create virtual canvas to support cropping (i.e. image.cmyk[100x100+10+20]).
160 canvas_image=CloneImage(image,image->extract_info.width,1,MagickFalse,
162 (void) SetImageVirtualPixelMethod(canvas_image,BlackVirtualPixelMethod,
164 quantum_info=AcquireQuantumInfo(image_info,canvas_image);
165 if (quantum_info == (QuantumInfo *) NULL)
166 ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
167 quantum_type=CMYKQuantum;
168 if (LocaleCompare(image_info->magick,"CMYKA") == 0)
170 quantum_type=CMYKAQuantum;
171 image->alpha_trait=BlendPixelTrait;
173 pixels=(const unsigned char *) NULL;
174 if (image_info->number_scenes != 0)
175 while (image->scene < image_info->scene)
181 length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
182 for (y=0; y < (ssize_t) image->rows; y++)
184 pixels=(const unsigned char *) ReadBlobStream(image,length,
185 GetQuantumPixels(quantum_info),&count);
186 if (count != (ssize_t) length)
196 Read pixels to virtual canvas image then push to image.
198 if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
199 if (image->scene >= (image_info->scene+image_info->number_scenes-1))
201 status=SetImageExtent(image,image->columns,image->rows,exception);
202 if (status == MagickFalse)
203 return(DestroyImageList(image));
204 SetImageColorspace(image,CMYKColorspace,exception);
205 switch (image_info->interlace)
211 No interlacing: CMYKCMYKCMYKCMYKCMYKCMYK...
215 length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
216 pixels=(const unsigned char *) ReadBlobStream(image,length,
217 GetQuantumPixels(quantum_info),&count);
219 for (y=0; y < (ssize_t) image->extract_info.height; y++)
221 register const Quantum
230 if (count != (ssize_t) length)
232 ThrowFileException(exception,CorruptImageError,
233 "UnexpectedEndOfFile",image->filename);
236 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
238 if (q == (Quantum *) NULL)
240 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
241 quantum_info,quantum_type,pixels,exception);
242 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
244 if (((y-image->extract_info.y) >= 0) &&
245 ((y-image->extract_info.y) < (ssize_t) image->rows))
247 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
248 canvas_image->columns,1,exception);
249 q=QueueAuthenticPixels(image,0,y-image->extract_info.y,
250 image->columns,1,exception);
251 if ((p == (const Quantum *) NULL) ||
252 (q == (Quantum *) NULL))
254 for (x=0; x < (ssize_t) image->columns; x++)
256 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
257 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
258 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
259 SetPixelBlack(image,GetPixelBlack(canvas_image,p),q);
260 SetPixelAlpha(image,OpaqueAlpha,q);
261 if (image->alpha_trait != UndefinedPixelTrait)
262 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
263 p+=GetPixelChannels(canvas_image);
264 q+=GetPixelChannels(image);
266 if (SyncAuthenticPixels(image,exception) == MagickFalse)
269 if (image->previous == (Image *) NULL)
271 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
273 if (status == MagickFalse)
276 pixels=(const unsigned char *) ReadBlobStream(image,length,
277 GetQuantumPixels(quantum_info),&count);
294 Line interlacing: CCC...MMM...YYY...KKK...CCC...MMM...YYY...KKK...
298 length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum);
299 pixels=(const unsigned char *) ReadBlobStream(image,length,
300 GetQuantumPixels(quantum_info),&count);
302 for (y=0; y < (ssize_t) image->extract_info.height; y++)
304 register const Quantum
313 if (count != (ssize_t) length)
315 ThrowFileException(exception,CorruptImageError,
316 "UnexpectedEndOfFile",image->filename);
319 for (i=0; i < (image->alpha_trait != UndefinedPixelTrait ? 5 : 4); i++)
321 quantum_type=quantum_types[i];
322 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
324 if (q == (Quantum *) NULL)
326 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
327 quantum_info,quantum_type,pixels,exception);
328 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
330 if (((y-image->extract_info.y) >= 0) &&
331 ((y-image->extract_info.y) < (ssize_t) image->rows))
333 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,
334 0,canvas_image->columns,1,exception);
335 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
336 image->columns,1,exception);
337 if ((p == (const Quantum *) NULL) ||
338 (q == (Quantum *) NULL))
340 for (x=0; x < (ssize_t) image->columns; x++)
342 switch (quantum_type)
346 SetPixelCyan(image,GetPixelCyan(canvas_image,p),q);
351 SetPixelMagenta(image,GetPixelMagenta(canvas_image,p),q);
356 SetPixelYellow(image,GetPixelYellow(canvas_image,p),q);
361 SetPixelBlack(image,GetPixelBlack(canvas_image,p),q);
366 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
372 p+=GetPixelChannels(canvas_image);
373 q+=GetPixelChannels(image);
375 if (SyncAuthenticPixels(image,exception) == MagickFalse)
378 pixels=(const unsigned char *) ReadBlobStream(image,length,
379 GetQuantumPixels(quantum_info),&count);
381 if (image->previous == (Image *) NULL)
383 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
385 if (status == MagickFalse)
394 Plane interlacing: CCCCCC...MMMMMM...YYYYYY...KKKKKK...
398 length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum);
399 pixels=(const unsigned char *) ReadBlobStream(image,length,
400 GetQuantumPixels(quantum_info),&count);
402 for (y=0; y < (ssize_t) image->extract_info.height; y++)
404 register const Quantum
413 if (count != (ssize_t) length)
415 ThrowFileException(exception,CorruptImageError,
416 "UnexpectedEndOfFile",image->filename);
419 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
421 if (q == (Quantum *) NULL)
423 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
424 quantum_info,CyanQuantum,pixels,exception);
425 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
427 if (((y-image->extract_info.y) >= 0) &&
428 ((y-image->extract_info.y) < (ssize_t) image->rows))
430 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
431 canvas_image->columns,1,exception);
432 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
433 image->columns,1,exception);
434 if ((p == (const Quantum *) NULL) ||
435 (q == (Quantum *) NULL))
437 for (x=0; x < (ssize_t) image->columns; x++)
439 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
440 p+=GetPixelChannels(canvas_image);
441 q+=GetPixelChannels(image);
443 if (SyncAuthenticPixels(image,exception) == MagickFalse)
446 pixels=(const unsigned char *) ReadBlobStream(image,length,
447 GetQuantumPixels(quantum_info),&count);
449 if (image->previous == (Image *) NULL)
451 status=SetImageProgress(image,LoadImageTag,1,6);
452 if (status == MagickFalse)
455 for (y=0; y < (ssize_t) image->extract_info.height; y++)
457 register const Quantum
466 if (count != (ssize_t) length)
468 ThrowFileException(exception,CorruptImageError,
469 "UnexpectedEndOfFile",image->filename);
472 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
474 if (q == (Quantum *) NULL)
476 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
477 quantum_info,MagentaQuantum,pixels,exception);
478 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
480 if (((y-image->extract_info.y) >= 0) &&
481 ((y-image->extract_info.y) < (ssize_t) image->rows))
483 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
484 canvas_image->columns,1,exception);
485 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
486 image->columns,1,exception);
487 if ((p == (const Quantum *) NULL) ||
488 (q == (Quantum *) NULL))
490 for (x=0; x < (ssize_t) image->columns; x++)
492 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
493 p+=GetPixelChannels(canvas_image);
494 q+=GetPixelChannels(image);
496 if (SyncAuthenticPixels(image,exception) == MagickFalse)
499 pixels=(const unsigned char *) ReadBlobStream(image,length,
500 GetQuantumPixels(quantum_info),&count);
502 if (image->previous == (Image *) NULL)
504 status=SetImageProgress(image,LoadImageTag,2,6);
505 if (status == MagickFalse)
508 for (y=0; y < (ssize_t) image->extract_info.height; y++)
510 register const Quantum
519 if (count != (ssize_t) length)
521 ThrowFileException(exception,CorruptImageError,
522 "UnexpectedEndOfFile",image->filename);
525 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
527 if (q == (Quantum *) NULL)
529 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
530 quantum_info,YellowQuantum,pixels,exception);
531 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
533 if (((y-image->extract_info.y) >= 0) &&
534 ((y-image->extract_info.y) < (ssize_t) image->rows))
536 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
537 canvas_image->columns,1,exception);
538 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
539 image->columns,1,exception);
540 if ((p == (const Quantum *) NULL) ||
541 (q == (Quantum *) NULL))
543 for (x=0; x < (ssize_t) image->columns; x++)
545 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
546 p+=GetPixelChannels(canvas_image);
547 q+=GetPixelChannels(image);
549 if (SyncAuthenticPixels(image,exception) == MagickFalse)
552 pixels=(const unsigned char *) ReadBlobStream(image,length,
553 GetQuantumPixels(quantum_info),&count);
555 if (image->previous == (Image *) NULL)
557 status=SetImageProgress(image,LoadImageTag,3,6);
558 if (status == MagickFalse)
561 for (y=0; y < (ssize_t) image->extract_info.height; y++)
563 register const Quantum
572 if (count != (ssize_t) length)
574 ThrowFileException(exception,CorruptImageError,
575 "UnexpectedEndOfFile",image->filename);
578 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
580 if (q == (Quantum *) NULL)
582 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
583 quantum_info,BlackQuantum,pixels,exception);
584 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
586 if (((y-image->extract_info.y) >= 0) &&
587 ((y-image->extract_info.y) < (ssize_t) image->rows))
589 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
590 canvas_image->columns,1,exception);
591 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
592 image->columns,1,exception);
593 if ((p == (const Quantum *) NULL) ||
594 (q == (Quantum *) NULL))
596 for (x=0; x < (ssize_t) image->columns; x++)
598 SetPixelBlack(image,GetPixelBlack(canvas_image,p),q);
599 p+=GetPixelChannels(canvas_image);
600 q+=GetPixelChannels(image);
602 if (SyncAuthenticPixels(image,exception) == MagickFalse)
605 pixels=(const unsigned char *) ReadBlobStream(image,length,
606 GetQuantumPixels(quantum_info),&count);
608 if (image->previous == (Image *) NULL)
610 status=SetImageProgress(image,LoadImageTag,4,6);
611 if (status == MagickFalse)
614 if (image->alpha_trait != UndefinedPixelTrait)
616 for (y=0; y < (ssize_t) image->extract_info.height; y++)
618 register const Quantum
627 if (count != (ssize_t) length)
629 ThrowFileException(exception,CorruptImageError,
630 "UnexpectedEndOfFile",image->filename);
633 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
635 if (q == (Quantum *) NULL)
637 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
638 quantum_info,AlphaQuantum,pixels,exception);
639 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
641 if (((y-image->extract_info.y) >= 0) &&
642 ((y-image->extract_info.y) < (ssize_t) image->rows))
644 p=GetVirtualPixels(canvas_image,
645 canvas_image->extract_info.x,0,canvas_image->columns,1,
647 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
648 image->columns,1,exception);
649 if ((p == (const Quantum *) NULL) ||
650 (q == (Quantum *) NULL))
652 for (x=0; x < (ssize_t) image->columns; x++)
654 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
655 p+=GetPixelChannels(canvas_image);
656 q+=GetPixelChannels(image);
658 if (SyncAuthenticPixels(image,exception) == MagickFalse)
661 pixels=(const unsigned char *) ReadBlobStream(image,length,
662 GetQuantumPixels(quantum_info),&count);
664 if (image->previous == (Image *) NULL)
666 status=SetImageProgress(image,LoadImageTag,5,6);
667 if (status == MagickFalse)
671 if (image->previous == (Image *) NULL)
673 status=SetImageProgress(image,LoadImageTag,6,6);
674 if (status == MagickFalse)
679 case PartitionInterlace:
682 Partition interlacing: CCCCCC..., MMMMMM..., YYYYYY..., KKKKKK...
684 AppendImageFormat("C",image->filename);
685 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
686 if (status == MagickFalse)
688 canvas_image=DestroyImageList(canvas_image);
689 image=DestroyImageList(image);
690 return((Image *) NULL);
692 if (DiscardBlobBytes(image,image->offset) == MagickFalse)
693 ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
695 length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum);
696 for (i=0; i < (ssize_t) scene; i++)
697 for (y=0; y < (ssize_t) image->extract_info.height; y++)
699 pixels=(const unsigned char *) ReadBlobStream(image,length,
700 GetQuantumPixels(quantum_info),&count);
701 if (count != (ssize_t) length)
703 ThrowFileException(exception,CorruptImageError,
704 "UnexpectedEndOfFile",image->filename);
708 pixels=(const unsigned char *) ReadBlobStream(image,length,
709 GetQuantumPixels(quantum_info),&count);
710 for (y=0; y < (ssize_t) image->extract_info.height; y++)
712 register const Quantum
721 if (count != (ssize_t) length)
723 ThrowFileException(exception,CorruptImageError,
724 "UnexpectedEndOfFile",image->filename);
727 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
729 if (q == (Quantum *) NULL)
731 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
732 quantum_info,CyanQuantum,pixels,exception);
733 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
735 if (((y-image->extract_info.y) >= 0) &&
736 ((y-image->extract_info.y) < (ssize_t) image->rows))
738 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
739 canvas_image->columns,1,exception);
740 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
741 image->columns,1,exception);
742 if ((p == (const Quantum *) NULL) ||
743 (q == (Quantum *) NULL))
745 for (x=0; x < (ssize_t) image->columns; x++)
747 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
748 p+=GetPixelChannels(canvas_image);
749 q+=GetPixelChannels(image);
751 if (SyncAuthenticPixels(image,exception) == MagickFalse)
754 pixels=(const unsigned char *) ReadBlobStream(image,length,
755 GetQuantumPixels(quantum_info),&count);
757 if (image->previous == (Image *) NULL)
759 status=SetImageProgress(image,LoadImageTag,1,5);
760 if (status == MagickFalse)
763 (void) CloseBlob(image);
764 AppendImageFormat("M",image->filename);
765 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
766 if (status == MagickFalse)
768 canvas_image=DestroyImageList(canvas_image);
769 image=DestroyImageList(image);
770 return((Image *) NULL);
772 length=GetQuantumExtent(canvas_image,quantum_info,MagentaQuantum);
773 for (i=0; i < (ssize_t) scene; i++)
774 for (y=0; y < (ssize_t) image->extract_info.height; y++)
776 pixels=(const unsigned char *) ReadBlobStream(image,length,
777 GetQuantumPixels(quantum_info),&count);
778 if (count != (ssize_t) length)
780 ThrowFileException(exception,CorruptImageError,
781 "UnexpectedEndOfFile",image->filename);
785 pixels=(const unsigned char *) ReadBlobStream(image,length,
786 GetQuantumPixels(quantum_info),&count);
787 for (y=0; y < (ssize_t) image->extract_info.height; y++)
789 register const Quantum
798 if (count != (ssize_t) length)
800 ThrowFileException(exception,CorruptImageError,
801 "UnexpectedEndOfFile",image->filename);
804 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
806 if (q == (Quantum *) NULL)
808 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
809 quantum_info,MagentaQuantum,pixels,exception);
810 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
812 if (((y-image->extract_info.y) >= 0) &&
813 ((y-image->extract_info.y) < (ssize_t) image->rows))
815 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
816 canvas_image->columns,1,exception);
817 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
818 image->columns,1,exception);
819 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
821 for (x=0; x < (ssize_t) image->columns; x++)
823 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
824 p+=GetPixelChannels(canvas_image);
825 q+=GetPixelChannels(image);
827 if (SyncAuthenticPixels(image,exception) == MagickFalse)
830 pixels=(const unsigned char *) ReadBlobStream(image,length,
831 GetQuantumPixels(quantum_info),&count);
833 if (image->previous == (Image *) NULL)
835 status=SetImageProgress(image,LoadImageTag,2,5);
836 if (status == MagickFalse)
839 (void) CloseBlob(image);
840 AppendImageFormat("Y",image->filename);
841 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
842 if (status == MagickFalse)
844 canvas_image=DestroyImageList(canvas_image);
845 image=DestroyImageList(image);
846 return((Image *) NULL);
848 length=GetQuantumExtent(canvas_image,quantum_info,YellowQuantum);
849 for (i=0; i < (ssize_t) scene; i++)
850 for (y=0; y < (ssize_t) image->extract_info.height; y++)
852 pixels=(const unsigned char *) ReadBlobStream(image,length,
853 GetQuantumPixels(quantum_info),&count);
854 if (count != (ssize_t) length)
856 ThrowFileException(exception,CorruptImageError,
857 "UnexpectedEndOfFile",image->filename);
861 pixels=(const unsigned char *) ReadBlobStream(image,length,
862 GetQuantumPixels(quantum_info),&count);
863 for (y=0; y < (ssize_t) image->extract_info.height; y++)
865 register const Quantum
874 if (count != (ssize_t) length)
876 ThrowFileException(exception,CorruptImageError,
877 "UnexpectedEndOfFile",image->filename);
880 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
882 if (q == (Quantum *) NULL)
884 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
885 quantum_info,YellowQuantum,pixels,exception);
886 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
888 if (((y-image->extract_info.y) >= 0) &&
889 ((y-image->extract_info.y) < (ssize_t) image->rows))
891 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
892 canvas_image->columns,1,exception);
893 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
894 image->columns,1,exception);
895 if ((p == (const Quantum *) NULL) ||
896 (q == (Quantum *) NULL))
898 for (x=0; x < (ssize_t) image->columns; x++)
900 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
901 p+=GetPixelChannels(canvas_image);
902 q+=GetPixelChannels(image);
904 if (SyncAuthenticPixels(image,exception) == MagickFalse)
907 pixels=(const unsigned char *) ReadBlobStream(image,length,
908 GetQuantumPixels(quantum_info),&count);
910 if (image->previous == (Image *) NULL)
912 status=SetImageProgress(image,LoadImageTag,3,5);
913 if (status == MagickFalse)
916 (void) CloseBlob(image);
917 AppendImageFormat("K",image->filename);
918 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
919 if (status == MagickFalse)
921 canvas_image=DestroyImageList(canvas_image);
922 image=DestroyImageList(image);
923 return((Image *) NULL);
925 length=GetQuantumExtent(canvas_image,quantum_info,BlackQuantum);
926 for (i=0; i < (ssize_t) scene; i++)
927 for (y=0; y < (ssize_t) image->extract_info.height; y++)
929 pixels=(const unsigned char *) ReadBlobStream(image,length,
930 GetQuantumPixels(quantum_info),&count);
931 if (count != (ssize_t) length)
933 ThrowFileException(exception,CorruptImageError,
934 "UnexpectedEndOfFile",image->filename);
938 pixels=(const unsigned char *) ReadBlobStream(image,length,
939 GetQuantumPixels(quantum_info),&count);
940 for (y=0; y < (ssize_t) image->extract_info.height; y++)
942 register const Quantum
951 if (count != (ssize_t) length)
953 ThrowFileException(exception,CorruptImageError,
954 "UnexpectedEndOfFile",image->filename);
957 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
959 if (q == (Quantum *) NULL)
961 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
962 quantum_info,BlackQuantum,pixels,exception);
963 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
965 if (((y-image->extract_info.y) >= 0) &&
966 ((y-image->extract_info.y) < (ssize_t) image->rows))
968 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
969 canvas_image->columns,1,exception);
970 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
971 image->columns,1,exception);
972 if ((p == (const Quantum *) NULL) ||
973 (q == (Quantum *) NULL))
975 for (x=0; x < (ssize_t) image->columns; x++)
977 SetPixelBlack(image,GetPixelBlack(canvas_image,p),q);
978 p+=GetPixelChannels(canvas_image);
979 q+=GetPixelChannels(image);
981 if (SyncAuthenticPixels(image,exception) == MagickFalse)
984 pixels=(const unsigned char *) ReadBlobStream(image,length,
985 GetQuantumPixels(quantum_info),&count);
987 if (image->previous == (Image *) NULL)
989 status=SetImageProgress(image,LoadImageTag,3,5);
990 if (status == MagickFalse)
993 if (image->alpha_trait != UndefinedPixelTrait)
995 (void) CloseBlob(image);
996 AppendImageFormat("A",image->filename);
997 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
998 if (status == MagickFalse)
1000 canvas_image=DestroyImageList(canvas_image);
1001 image=DestroyImageList(image);
1002 return((Image *) NULL);
1004 length=GetQuantumExtent(canvas_image,quantum_info,AlphaQuantum);
1005 for (i=0; i < (ssize_t) scene; i++)
1006 for (y=0; y < (ssize_t) image->extract_info.height; y++)
1008 pixels=(const unsigned char *) ReadBlobStream(image,length,
1009 GetQuantumPixels(quantum_info),&count);
1010 if (count != (ssize_t) length)
1012 ThrowFileException(exception,CorruptImageError,
1013 "UnexpectedEndOfFile",image->filename);
1017 pixels=(const unsigned char *) ReadBlobStream(image,length,
1018 GetQuantumPixels(quantum_info),
1020 for (y=0; y < (ssize_t) image->extract_info.height; y++)
1022 register const Quantum
1031 if (count != (ssize_t) length)
1033 ThrowFileException(exception,CorruptImageError,
1034 "UnexpectedEndOfFile",image->filename);
1037 q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
1039 if (q == (Quantum *) NULL)
1041 length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
1042 quantum_info,YellowQuantum,pixels,exception);
1043 if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
1045 if (((y-image->extract_info.y) >= 0) &&
1046 ((y-image->extract_info.y) < (ssize_t) image->rows))
1048 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,
1049 0,canvas_image->columns,1,exception);
1050 q=GetAuthenticPixels(image,0,y-image->extract_info.y,
1051 image->columns,1,exception);
1052 if ((p == (const Quantum *) NULL) ||
1053 (q == (Quantum *) NULL))
1055 for (x=0; x < (ssize_t) image->columns; x++)
1057 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
1058 p+=GetPixelChannels(canvas_image);
1059 q+=GetPixelChannels(image);
1061 if (SyncAuthenticPixels(image,exception) == MagickFalse)
1064 pixels=(const unsigned char *) ReadBlobStream(image,length,
1065 GetQuantumPixels(quantum_info),&count);
1067 if (image->previous == (Image *) NULL)
1069 status=SetImageProgress(image,LoadImageTag,4,5);
1070 if (status == MagickFalse)
1074 if (image->previous == (Image *) NULL)
1076 status=SetImageProgress(image,LoadImageTag,5,5);
1077 if (status == MagickFalse)
1083 SetQuantumImageType(image,quantum_type);
1085 Proceed to next image.
1087 if (image_info->number_scenes != 0)
1088 if (image->scene >= (image_info->scene+image_info->number_scenes-1))
1090 if (count == (ssize_t) length)
1093 Allocate next image structure.
1095 AcquireNextImage(image_info,image,exception);
1096 if (GetNextImageInList(image) == (Image *) NULL)
1098 image=DestroyImageList(image);
1099 return((Image *) NULL);
1101 image=SyncNextImageInList(image);
1102 status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
1103 GetBlobSize(image));
1104 if (status == MagickFalse)
1108 } while (count == (ssize_t) length);
1109 quantum_info=DestroyQuantumInfo(quantum_info);
1110 canvas_image=DestroyImage(canvas_image);
1111 (void) CloseBlob(image);
1112 return(GetFirstImageInList(image));
1116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1120 % R e g i s t e r C M Y K I m a g e %
1124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1126 % RegisterCMYKImage() adds attributes for the CMYK image format to
1127 % the list of supported formats. The attributes include the image format
1128 % tag, a method to read and/or write the format, whether the format
1129 % supports the saving of more than one frame to the same file or blob,
1130 % whether the format supports native in-memory I/O, and a brief
1131 % description of the format.
1133 % The format of the RegisterCMYKImage method is:
1135 % size_t RegisterCMYKImage(void)
1138 ModuleExport size_t RegisterCMYKImage(void)
1143 entry=AcquireMagickInfo("CMYK","CMYK",
1144 "Raw cyan, magenta, yellow, and black samples");
1145 entry->decoder=(DecodeImageHandler *) ReadCMYKImage;
1146 entry->encoder=(EncodeImageHandler *) WriteCMYKImage;
1147 entry->flags|=CoderRawSupportFlag;
1148 entry->flags|=CoderEndianSupportFlag;
1149 (void) RegisterMagickInfo(entry);
1150 entry=AcquireMagickInfo("CMYK","CMYKA",
1151 "Raw cyan, magenta, yellow, black, and alpha samples");
1152 entry->decoder=(DecodeImageHandler *) ReadCMYKImage;
1153 entry->encoder=(EncodeImageHandler *) WriteCMYKImage;
1154 entry->flags|=CoderRawSupportFlag;
1155 entry->flags|=CoderEndianSupportFlag;
1156 (void) RegisterMagickInfo(entry);
1157 return(MagickImageCoderSignature);
1161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1165 % U n r e g i s t e r C M Y K I m a g e %
1169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1171 % UnregisterCMYKImage() removes format registrations made by the
1172 % CMYK module from the list of supported formats.
1174 % The format of the UnregisterCMYKImage method is:
1176 % UnregisterCMYKImage(void)
1179 ModuleExport void UnregisterCMYKImage(void)
1181 (void) UnregisterMagickInfo("CMYK");
1182 (void) UnregisterMagickInfo("CMYKA");
1186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1190 % W r i t e C M Y K I m a g e %
1194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1196 % WriteCMYKImage() writes an image to a file in cyan, magenta, yellow, and
1197 % black,rasterfile format.
1199 % The format of the WriteCMYKImage method is:
1201 % MagickBooleanType WriteCMYKImage(const ImageInfo *image_info,
1202 % Image *image,ExceptionInfo *exception)
1204 % A description of each parameter follows.
1206 % o image_info: the image info.
1208 % o image: The image.
1210 % o exception: return any errors or warnings in this structure.
1213 static MagickBooleanType WriteCMYKImage(const ImageInfo *image_info,
1214 Image *image,ExceptionInfo *exception)
1239 Allocate memory for pixels.
1241 assert(image_info != (const ImageInfo *) NULL);
1242 assert(image_info->signature == MagickCoreSignature);
1243 assert(image != (Image *) NULL);
1244 assert(image->signature == MagickCoreSignature);
1245 if (image->debug != MagickFalse)
1246 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
1247 if (image_info->interlace != PartitionInterlace)
1250 Open output image file.
1252 status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
1253 if (status == MagickFalse)
1260 Convert MIFF to CMYK raster pixels.
1262 if (image->colorspace != CMYKColorspace)
1263 (void) TransformImageColorspace(image,CMYKColorspace,exception);
1264 quantum_type=CMYKQuantum;
1265 if (LocaleCompare(image_info->magick,"CMYKA") == 0)
1267 quantum_type=CMYKAQuantum;
1268 if (image->alpha_trait == UndefinedPixelTrait)
1269 (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
1271 quantum_info=AcquireQuantumInfo(image_info,image);
1272 if (quantum_info == (QuantumInfo *) NULL)
1273 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
1274 pixels=(unsigned char *) GetQuantumPixels(quantum_info);
1275 switch (image_info->interlace)
1281 No interlacing: CMYKCMYKCMYKCMYKCMYKCMYK...
1283 for (y=0; y < (ssize_t) image->rows; y++)
1285 register const Quantum
1288 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1289 if (p == (const Quantum *) NULL)
1291 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1292 quantum_type,pixels,exception);
1293 count=WriteBlob(image,length,pixels);
1294 if (count != (ssize_t) length)
1296 if (image->previous == (Image *) NULL)
1298 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
1300 if (status == MagickFalse)
1309 Line interlacing: CCC...MMM...YYY...KKK...CCC...MMM...YYY...KKK...
1311 for (y=0; y < (ssize_t) image->rows; y++)
1313 register const Quantum
1316 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1317 if (p == (const Quantum *) NULL)
1319 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1320 CyanQuantum,pixels,exception);
1321 count=WriteBlob(image,length,pixels);
1322 if (count != (ssize_t) length)
1324 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1325 MagentaQuantum,pixels,exception);
1326 count=WriteBlob(image,length,pixels);
1327 if (count != (ssize_t) length)
1329 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1330 YellowQuantum,pixels,exception);
1331 count=WriteBlob(image,length,pixels);
1332 if (count != (ssize_t) length)
1334 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1335 BlackQuantum,pixels,exception);
1336 count=WriteBlob(image,length,pixels);
1337 if (count != (ssize_t) length)
1339 if (quantum_type == CMYKAQuantum)
1341 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1342 AlphaQuantum,pixels,exception);
1343 count=WriteBlob(image,length,pixels);
1344 if (count != (ssize_t) length)
1347 if (image->previous == (Image *) NULL)
1349 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
1351 if (status == MagickFalse)
1357 case PlaneInterlace:
1360 Plane interlacing: CCCCCC...MMMMMM...YYYYYY...KKKKKK...
1362 for (y=0; y < (ssize_t) image->rows; y++)
1364 register const Quantum
1367 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1368 if (p == (const Quantum *) NULL)
1370 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1371 CyanQuantum,pixels,exception);
1372 count=WriteBlob(image,length,pixels);
1373 if (count != (ssize_t) length)
1376 if (image->previous == (Image *) NULL)
1378 status=SetImageProgress(image,SaveImageTag,1,6);
1379 if (status == MagickFalse)
1382 for (y=0; y < (ssize_t) image->rows; y++)
1384 register const Quantum
1387 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1388 if (p == (const Quantum *) NULL)
1390 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1391 MagentaQuantum,pixels,exception);
1392 count=WriteBlob(image,length,pixels);
1393 if (count != (ssize_t) length)
1396 if (image->previous == (Image *) NULL)
1398 status=SetImageProgress(image,SaveImageTag,2,6);
1399 if (status == MagickFalse)
1402 for (y=0; y < (ssize_t) image->rows; y++)
1404 register const Quantum
1407 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1408 if (p == (const Quantum *) NULL)
1410 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1411 YellowQuantum,pixels,exception);
1412 count=WriteBlob(image,length,pixels);
1413 if (count != (ssize_t) length)
1416 if (image->previous == (Image *) NULL)
1418 status=SetImageProgress(image,SaveImageTag,3,6);
1419 if (status == MagickFalse)
1422 for (y=0; y < (ssize_t) image->rows; y++)
1424 register const Quantum
1427 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1428 if (p == (const Quantum *) NULL)
1430 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1431 BlackQuantum,pixels,exception);
1432 count=WriteBlob(image,length,pixels);
1433 if (count != (ssize_t) length)
1436 if (image->previous == (Image *) NULL)
1438 status=SetImageProgress(image,SaveImageTag,4,6);
1439 if (status == MagickFalse)
1442 if (quantum_type == CMYKAQuantum)
1444 for (y=0; y < (ssize_t) image->rows; y++)
1446 register const Quantum
1449 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1450 if (p == (const Quantum *) NULL)
1452 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1453 AlphaQuantum,pixels,exception);
1454 count=WriteBlob(image,length,pixels);
1455 if (count != (ssize_t) length)
1458 if (image->previous == (Image *) NULL)
1460 status=SetImageProgress(image,SaveImageTag,5,6);
1461 if (status == MagickFalse)
1465 if (image_info->interlace == PartitionInterlace)
1466 (void) CopyMagickString(image->filename,image_info->filename,
1468 if (image->previous == (Image *) NULL)
1470 status=SetImageProgress(image,SaveImageTag,6,6);
1471 if (status == MagickFalse)
1476 case PartitionInterlace:
1479 Partition interlacing: CCCCCC..., MMMMMM..., YYYYYY..., KKKKKK...
1481 AppendImageFormat("C",image->filename);
1482 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
1483 AppendBinaryBlobMode,exception);
1484 if (status == MagickFalse)
1486 for (y=0; y < (ssize_t) image->rows; y++)
1488 register const Quantum
1491 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1492 if (p == (const Quantum *) NULL)
1494 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1495 CyanQuantum,pixels,exception);
1496 count=WriteBlob(image,length,pixels);
1497 if (count != (ssize_t) length)
1500 if (image->previous == (Image *) NULL)
1502 status=SetImageProgress(image,SaveImageTag,1,6);
1503 if (status == MagickFalse)
1506 (void) CloseBlob(image);
1507 AppendImageFormat("M",image->filename);
1508 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
1509 AppendBinaryBlobMode,exception);
1510 if (status == MagickFalse)
1512 for (y=0; y < (ssize_t) image->rows; y++)
1514 register const Quantum
1517 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1518 if (p == (const Quantum *) NULL)
1520 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1521 MagentaQuantum,pixels,exception);
1522 count=WriteBlob(image,length,pixels);
1523 if (count != (ssize_t) length)
1526 if (image->previous == (Image *) NULL)
1528 status=SetImageProgress(image,SaveImageTag,2,6);
1529 if (status == MagickFalse)
1532 (void) CloseBlob(image);
1533 AppendImageFormat("Y",image->filename);
1534 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
1535 AppendBinaryBlobMode,exception);
1536 if (status == MagickFalse)
1538 for (y=0; y < (ssize_t) image->rows; y++)
1540 register const Quantum
1543 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1544 if (p == (const Quantum *) NULL)
1546 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1547 YellowQuantum,pixels,exception);
1548 count=WriteBlob(image,length,pixels);
1549 if (count != (ssize_t) length)
1552 if (image->previous == (Image *) NULL)
1554 status=SetImageProgress(image,SaveImageTag,3,6);
1555 if (status == MagickFalse)
1558 (void) CloseBlob(image);
1559 AppendImageFormat("K",image->filename);
1560 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
1561 AppendBinaryBlobMode,exception);
1562 if (status == MagickFalse)
1564 for (y=0; y < (ssize_t) image->rows; y++)
1566 register const Quantum
1569 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1570 if (p == (const Quantum *) NULL)
1572 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1573 BlackQuantum,pixels,exception);
1574 count=WriteBlob(image,length,pixels);
1575 if (count != (ssize_t) length)
1578 if (image->previous == (Image *) NULL)
1580 status=SetImageProgress(image,SaveImageTag,4,6);
1581 if (status == MagickFalse)
1584 if (quantum_type == CMYKAQuantum)
1586 (void) CloseBlob(image);
1587 AppendImageFormat("A",image->filename);
1588 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
1589 AppendBinaryBlobMode,exception);
1590 if (status == MagickFalse)
1592 for (y=0; y < (ssize_t) image->rows; y++)
1594 register const Quantum
1597 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1598 if (p == (const Quantum *) NULL)
1600 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1601 AlphaQuantum,pixels,exception);
1602 count=WriteBlob(image,length,pixels);
1603 if (count != (ssize_t) length)
1606 if (image->previous == (Image *) NULL)
1608 status=SetImageProgress(image,SaveImageTag,5,6);
1609 if (status == MagickFalse)
1613 (void) CloseBlob(image);
1614 (void) CopyMagickString(image->filename,image_info->filename,
1616 if (image->previous == (Image *) NULL)
1618 status=SetImageProgress(image,SaveImageTag,6,6);
1619 if (status == MagickFalse)
1625 quantum_info=DestroyQuantumInfo(quantum_info);
1626 if (GetNextImageInList(image) == (Image *) NULL)
1628 image=SyncNextImageInList(image);
1629 status=SetImageProgress(image,SaveImagesTag,scene++,
1630 GetImageListLength(image));
1631 if (status == MagickFalse)
1633 } while (image_info->adjoin != MagickFalse);
1634 (void) CloseBlob(image);