2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 % Read/Write HP PCL Printer Format %
20 % Copyright 1999-2010 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 % http://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 "magick/studio.h"
43 #include "magick/property.h"
44 #include "magick/blob.h"
45 #include "magick/blob-private.h"
46 #include "magick/cache.h"
47 #include "magick/color.h"
48 #include "magick/color-private.h"
49 #include "magick/colorspace.h"
50 #include "magick/constitute.h"
51 #include "magick/delegate.h"
52 #include "magick/draw.h"
53 #include "magick/exception.h"
54 #include "magick/exception-private.h"
55 #include "magick/geometry.h"
56 #include "magick/image.h"
57 #include "magick/image-private.h"
58 #include "magick/list.h"
59 #include "magick/magick.h"
60 #include "magick/memory_.h"
61 #include "magick/monitor.h"
62 #include "magick/monitor-private.h"
63 #include "magick/option.h"
64 #include "magick/profile.h"
65 #include "magick/resource_.h"
66 #include "magick/quantum-private.h"
67 #include "magick/static.h"
68 #include "magick/string_.h"
69 #include "magick/module.h"
70 #include "magick/token.h"
71 #include "magick/transform.h"
72 #include "magick/utility.h"
77 static MagickBooleanType
78 WritePCLImage(const ImageInfo *,Image *);
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91 % IsPCL() returns MagickTrue if the image format type, identified by the
92 % magick string, is PCL.
94 % The format of the IsPCL method is:
96 % MagickBooleanType IsPCL(const unsigned char *magick,const size_t length)
98 % A description of each parameter follows:
100 % o magick: compare image format pattern against these bytes.
102 % o length: Specifies the length of the magick string.
105 static MagickBooleanType IsPCL(const unsigned char *magick,const size_t length)
109 if (memcmp(magick,"\033E\033",3) == 0)
111 if (memcmp(magick,"\033E\033&",4) == 0)
117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
121 % R e a d P C L I m a g e %
125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127 % ReadPCLImage() reads a Printer Control Language image file and returns it.
128 % It allocates the memory necessary for the new Image structure and returns a
129 % pointer to the new image.
131 % The format of the ReadPCLImage method is:
133 % Image *ReadPCLImage(const ImageInfo *image_info,ExceptionInfo *exception)
135 % A description of each parameter follows:
137 % o image_info: the image info.
139 % o exception: return any errors or warnings in this structure.
142 static Image *ReadPCLImage(const ImageInfo *image_info,ExceptionInfo *exception)
144 #define CropBox "CropBox"
145 #define DeviceCMYK "DeviceCMYK"
146 #define MediaBox "MediaBox"
147 #define RenderPCLText " Rendering PCL... "
150 command[MaxTextExtent],
151 density[MaxTextExtent],
152 filename[MaxTextExtent],
153 geometry[MaxTextExtent],
154 options[MaxTextExtent],
155 input_filename[MaxTextExtent];
194 assert(image_info != (const ImageInfo *) NULL);
195 assert(image_info->signature == MagickSignature);
196 if (image_info->debug != MagickFalse)
197 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
198 image_info->filename);
199 assert(exception != (ExceptionInfo *) NULL);
200 assert(exception->signature == MagickSignature);
204 image=AcquireImage(image_info);
205 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
206 if (status == MagickFalse)
208 image=DestroyImageList(image);
209 return((Image *) NULL);
211 status=AcquireUniqueSymbolicLink(image_info->filename,input_filename);
212 if (status == MagickFalse)
214 ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile",
215 image_info->filename);
216 image=DestroyImageList(image);
217 return((Image *) NULL);
220 Set the page density.
222 delta.x=DefaultResolution;
223 delta.y=DefaultResolution;
224 if ((image->x_resolution == 0.0) || (image->y_resolution == 0.0))
232 flags=ParseGeometry(PSDensityGeometry,&geometry_info);
233 image->x_resolution=geometry_info.rho;
234 image->y_resolution=geometry_info.sigma;
235 if ((flags & SigmaValue) == 0)
236 image->y_resolution=image->x_resolution;
239 Determine page geometry from the PCL media box.
241 cmyk=image->colorspace == CMYKColorspace ? MagickTrue : MagickFalse;
243 (void) ResetMagickMemory(&bounding_box,0,sizeof(bounding_box));
244 (void) ResetMagickMemory(&bounds,0,sizeof(bounds));
245 (void) ResetMagickMemory(&page,0,sizeof(page));
246 (void) ResetMagickMemory(command,0,sizeof(command));
248 for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image))
250 if (image_info->page != (char *) NULL)
256 if ((c != (int) '/') && (c != '\n') &&
257 ((size_t) (p-command) < (MaxTextExtent-1)))
262 Is this a CMYK document?
264 if (LocaleNCompare(DeviceCMYK,command,strlen(DeviceCMYK)) == 0)
266 if (LocaleNCompare(CropBox,command,strlen(CropBox)) == 0)
269 Note region defined by crop box.
271 count=(ssize_t) sscanf(command,"CropBox [%lf %lf %lf %lf",
272 &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
274 count=(ssize_t) sscanf(command,"CropBox[%lf %lf %lf %lf",
275 &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
277 if (LocaleNCompare(MediaBox,command,strlen(MediaBox)) == 0)
280 Note region defined by media box.
282 count=(ssize_t) sscanf(command,"MediaBox [%lf %lf %lf %lf",
283 &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
285 count=(ssize_t) sscanf(command,"MediaBox[%lf %lf %lf %lf",
286 &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
291 Set PCL render geometry.
293 width=(size_t) floor(bounds.x2-bounds.x1+0.5);
294 height=(size_t) floor(bounds.y2-bounds.y1+0.5);
295 if (width > page.width)
297 if (height > page.height)
300 (void) CloseBlob(image);
302 Render PCL with the GhostPCL delegate.
304 if ((page.width == 0) || (page.height == 0))
305 (void) ParseAbsoluteGeometry(PSPageGeometry,&page);
306 if (image_info->page != (char *) NULL)
307 (void) ParseAbsoluteGeometry(image_info->page,&page);
308 (void) FormatMagickString(geometry,MaxTextExtent,"%.20gx%.20g",(double)
309 page.width,(double) page.height);
310 if (image_info->monochrome != MagickFalse)
311 delegate_info=GetDelegateInfo("pcl:mono",(char *) NULL,exception);
313 if (cmyk != MagickFalse)
314 delegate_info=GetDelegateInfo("pcl:cmyk",(char *) NULL,exception);
316 delegate_info=GetDelegateInfo("pcl:color",(char *) NULL,exception);
317 if (delegate_info == (const DelegateInfo *) NULL)
318 return((Image *) NULL);
320 if ((page.width == 0) || (page.height == 0))
321 (void) ParseAbsoluteGeometry(PSPageGeometry,&page);
322 if (image_info->page != (char *) NULL)
323 (void) ParseAbsoluteGeometry(image_info->page,&page);
324 (void) FormatMagickString(density,MaxTextExtent,"%gx%g",
325 image->x_resolution,image->y_resolution);
326 page.width=(size_t) floor(page.width*image->x_resolution/delta.x+0.5);
327 page.height=(size_t) floor(page.height*image->y_resolution/delta.y+
329 (void) FormatMagickString(options,MaxTextExtent,"-g%.20gx%.20g ",(double)
330 page.width,(double) page.height);
331 image=DestroyImage(image);
332 read_info=CloneImageInfo(image_info);
333 *read_info->magick='\0';
334 if (read_info->number_scenes != 0)
336 if (read_info->number_scenes != 1)
337 (void) FormatMagickString(options,MaxTextExtent,"-dLastPage=%.20g",
338 (double) (read_info->scene+read_info->number_scenes));
340 (void) FormatMagickString(options,MaxTextExtent,
341 "-dFirstPage=%.20g -dLastPage=%.20g",(double) read_info->scene+1,
342 (double) (read_info->scene+read_info->number_scenes));
343 read_info->number_scenes=0;
344 if (read_info->scenes != (char *) NULL)
345 *read_info->scenes='\0';
347 if (read_info->authenticate != (char *) NULL)
348 (void) FormatMagickString(options+strlen(options),MaxTextExtent,
349 " -sPCLPassword=%s",read_info->authenticate);
350 (void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
351 (void) AcquireUniqueFilename(read_info->filename);
352 (void) FormatMagickString(command,MaxTextExtent,
353 GetDelegateCommands(delegate_info),
354 read_info->antialias != MagickFalse ? 4 : 1,
355 read_info->antialias != MagickFalse ? 4 : 1,density,options,
356 read_info->filename,input_filename);
357 status=SystemCommand(MagickFalse,read_info->verbose,command,exception) != 0 ?
358 MagickTrue : MagickFalse;
359 image=ReadImage(read_info,exception);
360 (void) RelinquishUniqueFileResource(read_info->filename);
361 (void) RelinquishUniqueFileResource(input_filename);
362 read_info=DestroyImageInfo(read_info);
363 if (image == (Image *) NULL)
364 ThrowReaderException(DelegateError,"PCLDelegateFailed");
365 if (LocaleCompare(image->magick,"BMP") == 0)
370 cmyk_image=ConsolidateCMYKImages(image,&image->exception);
371 if (cmyk_image != (Image *) NULL)
373 image=DestroyImageList(image);
379 (void) CopyMagickString(image->filename,filename,MaxTextExtent);
381 next_image=SyncNextImageInList(image);
382 if (next_image != (Image *) NULL)
384 } while (next_image != (Image *) NULL);
385 return(GetFirstImageInList(image));
389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
393 % R e g i s t e r P C L I m a g e %
397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
399 % RegisterPCLImage() adds attributes for the PCL image format to
400 % the list of supported formats. The attributes include the image format
401 % tag, a method to read and/or write the format, whether the format
402 % supports the saving of more than one frame to the i file or blob,
403 % whether the format supports native in-memory I/O, and a brief
404 % description of the format.
406 % The format of the RegisterPCLImage method is:
408 % size_t RegisterPCLImage(void)
411 ModuleExport size_t RegisterPCLImage(void)
416 entry=SetMagickInfo("PCL");
417 entry->decoder=(DecodeImageHandler *) ReadPCLImage;
418 entry->encoder=(EncodeImageHandler *) WritePCLImage;
419 entry->magick=(IsImageFormatHandler *) IsPCL;
420 entry->blob_support=MagickFalse;
421 entry->seekable_stream=MagickTrue;
422 entry->thread_support=EncoderThreadSupport;
423 entry->description=ConstantString("Printer Control Language");
424 entry->module=ConstantString("PCL");
425 (void) RegisterMagickInfo(entry);
426 return(MagickImageCoderSignature);
430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
434 % U n r e g i s t e r P C L I m a g e %
438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
440 % UnregisterPCLImage() removes format registrations made by the PCL module
441 % from the list of supported formats.
443 % The format of the UnregisterPCLImage method is:
445 % UnregisterPCLImage(void)
448 ModuleExport void UnregisterPCLImage(void)
450 (void) UnregisterMagickInfo("PCL");
454 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
458 % W r i t e P C L I m a g e %
462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
464 % WritePCLImage() writes an image in the Page Control Language encoded
467 % The format of the WritePCLImage method is:
469 % MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image)
471 % A description of each parameter follows.
473 % o image_info: the image info.
475 % o image: The image.
479 static size_t PCLDeltaCompressImage(const size_t length,
480 const unsigned char *previous_pixels,const unsigned char *pixels,
481 unsigned char *compress_pixels)
492 register unsigned char
496 for (x=0; x < (ssize_t) length; )
499 for (i=0; x < (ssize_t) length; x++)
501 if (*pixels++ != *previous_pixels++)
508 for ( ; x < (ssize_t) length; x++)
510 if (*pixels == *previous_pixels)
518 replacement=j >= 31 ? 31 : j;
520 delta=i >= 8 ? 8 : i;
521 *q++=(unsigned char) (((delta-1) << 5) | replacement);
522 if (replacement == 31)
524 for (replacement=255; j != 0; )
528 *q++=(unsigned char) replacement;
531 if (replacement == 255)
534 for (pixels-=i; i != 0; )
536 for (i-=delta; delta != 0; delta--)
543 *q++=(unsigned char) ((delta-1) << 5);
546 return((size_t) (q-compress_pixels));
549 static size_t PCLPackbitsCompressImage(const size_t length,
550 const unsigned char *pixels,unsigned char *compress_pixels)
561 register unsigned char
568 Compress pixels with Packbits encoding.
571 for (x=(ssize_t) length; x != 0; )
593 if ((*pixels == *(pixels+1)) && (*(pixels+1) == *(pixels+2)))
595 *q++=(unsigned char) ((256-3)+1);
607 if ((*pixels == *(pixels+1)) && (*(pixels+1) == *(pixels+2)))
613 while (((ssize_t) count < x) && (*pixels == *(pixels+count)))
620 *q++=(unsigned char) ((256-count)+1);
629 while ((*(pixels+count) != *(pixels+count+1)) ||
630 (*(pixels+count+1) != *(pixels+count+2)))
632 packbits[count+1]=pixels[count];
634 if (((ssize_t) count >= (x-3)) || (count >= 127))
638 *packbits=(unsigned char) (count-1);
639 for (j=0; j <= (ssize_t) count; j++)
646 *q++=128; /* EOD marker */
647 return((size_t) (q-compress_pixels));
650 static MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image)
653 buffer[MaxTextExtent];
667 register const IndexPacket
670 register const PixelPacket
677 register unsigned char
695 Open output image file.
697 assert(image_info != (const ImageInfo *) NULL);
698 assert(image_info->signature == MagickSignature);
699 assert(image != (Image *) NULL);
700 assert(image->signature == MagickSignature);
701 if (image->debug != MagickFalse)
702 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
703 status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
704 if (status == MagickFalse)
707 if (image_info->density != (char *) NULL)
712 (void) ParseGeometry(image_info->density,&geometry);
713 density=(size_t) geometry.rho;
719 if (image->colorspace != RGBColorspace)
720 (void) TransformImageColorspace(image,RGBColorspace);
722 Initialize the printer.
724 (void) WriteBlobString(image,"\033E"); /* printer reset */
725 (void) WriteBlobString(image,"\033*r3F"); /* set presentation mode */
726 (void) FormatMagickString(buffer,MaxTextExtent,"\033*r%.20gs%.20gT",
727 (double) image->columns,(double) image->rows);
728 (void) WriteBlobString(image,buffer);
729 (void) FormatMagickString(buffer,MaxTextExtent,"\033*t%.20gR",(double)
731 (void) WriteBlobString(image,buffer);
732 (void) WriteBlobString(image,"\033&l0E"); /* top margin 0 */
733 if (IsMonochromeImage(image,&image->exception) != MagickFalse)
739 (void) WriteBlobString(image,"\033*v6W"); /* set color mode... */
740 (void) WriteBlobByte(image,0); /* RGB */
741 (void) WriteBlobByte(image,1); /* indexed by pixel */
742 (void) WriteBlobByte(image,bits_per_pixel); /* bits per index */
743 (void) WriteBlobByte(image,8); /* bits per red component */
744 (void) WriteBlobByte(image,8); /* bits per green component */
745 (void) WriteBlobByte(image,8); /* bits per blue component */
746 (void) FormatMagickString(buffer,MaxTextExtent,"\033*v0a0b0c0I");
747 (void) WriteBlobString(image,buffer);
748 (void) FormatMagickString(buffer,MaxTextExtent,"\033*v1a1b1c1I");
749 (void) WriteBlobString(image,buffer);
752 if (image->storage_class == DirectClass)
758 (void) WriteBlobString(image,"\033*v6W"); /* set color mode */
759 (void) WriteBlobByte(image,0); /* RGB */
760 (void) WriteBlobByte(image,3); /* direct by pixel */
761 (void) WriteBlobByte(image,0); /* bits per index (ignored) */
762 (void) WriteBlobByte(image,8); /* bits per red component */
763 (void) WriteBlobByte(image,8); /* bits per green component */
764 (void) WriteBlobByte(image,8); /* bits per blue component */
772 (void) WriteBlobString(image,"\033*v6W"); /* set color mode... */
773 (void) WriteBlobByte(image,0); /* RGB */
774 (void) WriteBlobByte(image,1); /* indexed by pixel */
775 (void) WriteBlobByte(image,bits_per_pixel); /* bits per index */
776 (void) WriteBlobByte(image,8); /* bits per red component */
777 (void) WriteBlobByte(image,8); /* bits per green component */
778 (void) WriteBlobByte(image,8); /* bits per blue component */
779 for (i=0; i < (ssize_t) image->colors; i++)
781 (void) FormatMagickString(buffer,MaxTextExtent,
782 "\033*v%da%db%dc%.20gI",
783 ScaleQuantumToChar(image->colormap[i].red),
784 ScaleQuantumToChar(image->colormap[i].green),
785 ScaleQuantumToChar(image->colormap[i].blue),(double) i);
786 (void) WriteBlobString(image,buffer);
789 for ( ; i < (ssize_t) (one << bits_per_pixel); i++)
791 (void) FormatMagickString(buffer,MaxTextExtent,"\033*v%.20gI",
793 (void) WriteBlobString(image,buffer);
796 option=GetImageOption(image_info,"pcl:fit-to-page");
797 if ((option != (const char *) NULL) &&
798 (IsMagickTrue(option) != MagickFalse))
799 (void) WriteBlobString(image,"\033*r3A");
801 (void) WriteBlobString(image,"\033*r1A"); /* start raster graphics */
802 (void) WriteBlobString(image,"\033*b0Y"); /* set y offset */
803 length=(image->columns*bits_per_pixel+7)/8;
804 pixels=(unsigned char *) AcquireQuantumMemory(length,sizeof(*pixels));
805 if (pixels == (unsigned char *) NULL)
806 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
807 compress_pixels=(unsigned char *) NULL;
808 previous_pixels=(unsigned char *) NULL;
809 switch (image->compression)
813 (void) FormatMagickString(buffer,MaxTextExtent,"\033*b0M");
814 (void) WriteBlobString(image,buffer);
819 compress_pixels=(unsigned char *) AcquireQuantumMemory(length+256,
820 sizeof(*compress_pixels));
821 if (compress_pixels == (unsigned char *) NULL)
823 pixels=(unsigned char *) RelinquishMagickMemory(pixels);
824 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
826 (void) FormatMagickString(buffer,MaxTextExtent,"\033*b2M");
827 (void) WriteBlobString(image,buffer);
832 compress_pixels=(unsigned char *) AcquireQuantumMemory(length+
833 (length >> 3),sizeof(*compress_pixels));
834 if (compress_pixels == (unsigned char *) NULL)
836 pixels=(unsigned char *) RelinquishMagickMemory(pixels);
837 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
839 previous_pixels=(unsigned char *) AcquireQuantumMemory(length,
840 sizeof(*previous_pixels));
841 if (previous_pixels == (unsigned char *) NULL)
843 compress_pixels=(unsigned char *) RelinquishMagickMemory(
845 pixels=(unsigned char *) RelinquishMagickMemory(pixels);
846 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
848 (void) FormatMagickString(buffer,MaxTextExtent,"\033*b3M");
849 (void) WriteBlobString(image,buffer);
853 for (y=0; y < (ssize_t) image->rows; y++)
855 p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
856 if (p == (const PixelPacket *) NULL)
858 indexes=GetAuthenticIndexQueue(image);
860 switch (bits_per_pixel)
864 register unsigned char
873 for (x=0; x < (ssize_t) image->columns; x++)
876 if (PixelIntensity(p) >= ((MagickRealType) QuantumRange/2.0))
888 *q++=byte << (8-bit);
896 for (x=0; x < (ssize_t) image->columns; x++)
897 *q++=(unsigned char) indexes[x];
906 for (x=0; x < (ssize_t) image->columns; x++)
908 *q++=ScaleQuantumToChar(GetRedPixelComponent(p));
909 *q++=ScaleQuantumToChar(GetGreenPixelComponent(p));
910 *q++=ScaleQuantumToChar(GetBluePixelComponent(p));
916 switch (image->compression)
920 (void) FormatMagickString(buffer,MaxTextExtent,"\033*b%.20gW",
922 (void) WriteBlobString(image,buffer);
923 (void) WriteBlob(image,length,pixels);
928 packets=PCLPackbitsCompressImage(length,pixels,
930 (void) FormatMagickString(buffer,MaxTextExtent,"\033*b%.20gW",
932 (void) WriteBlobString(image,buffer);
933 (void) WriteBlob(image,packets,compress_pixels);
939 for (i=0; i < (ssize_t) length; i++)
940 previous_pixels[i]=(~pixels[i]);
941 packets=PCLDeltaCompressImage(length,previous_pixels,pixels,
943 (void) FormatMagickString(buffer,MaxTextExtent,"\033*b%.20gW",
945 (void) WriteBlobString(image,buffer);
946 (void) WriteBlob(image,packets,compress_pixels);
947 (void) CopyMagickMemory(previous_pixels,pixels,length*
953 (void) WriteBlobString(image,"\033*rB"); /* end graphics */
954 switch (image->compression)
960 compress_pixels=(unsigned char *) RelinquishMagickMemory(
966 previous_pixels=(unsigned char *) RelinquishMagickMemory(
968 compress_pixels=(unsigned char *) RelinquishMagickMemory(
973 pixels=(unsigned char *) RelinquishMagickMemory(pixels);
974 if (GetNextImageInList(image) == (Image *) NULL)
976 image=SyncNextImageInList(image);
977 status=SetImageProgress(image,SaveImagesTag,scene++,
978 GetImageListLength(image));
979 if (status == MagickFalse)
981 } while (image_info->adjoin != MagickFalse);
982 (void) WriteBlobString(image,"\033E");
983 (void) CloseBlob(image);