2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 % Read/Write HP PCL Printer Format %
20 % Copyright 1999-2011 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 "MagickCore/studio.h"
43 #include "MagickCore/attribute.h"
44 #include "MagickCore/blob.h"
45 #include "MagickCore/blob-private.h"
46 #include "MagickCore/cache.h"
47 #include "MagickCore/color.h"
48 #include "MagickCore/color-private.h"
49 #include "MagickCore/colorspace.h"
50 #include "MagickCore/constitute.h"
51 #include "MagickCore/delegate.h"
52 #include "MagickCore/draw.h"
53 #include "MagickCore/exception.h"
54 #include "MagickCore/exception-private.h"
55 #include "MagickCore/geometry.h"
56 #include "MagickCore/image.h"
57 #include "MagickCore/image-private.h"
58 #include "MagickCore/list.h"
59 #include "MagickCore/magick.h"
60 #include "MagickCore/memory_.h"
61 #include "MagickCore/monitor.h"
62 #include "MagickCore/monitor-private.h"
63 #include "MagickCore/option.h"
64 #include "MagickCore/pixel-accessor.h"
65 #include "MagickCore/profile.h"
66 #include "MagickCore/property.h"
67 #include "MagickCore/resource_.h"
68 #include "MagickCore/quantum-private.h"
69 #include "MagickCore/static.h"
70 #include "MagickCore/string_.h"
71 #include "MagickCore/module.h"
72 #include "MagickCore/token.h"
73 #include "MagickCore/transform.h"
74 #include "MagickCore/utility.h"
79 static MagickBooleanType
80 WritePCLImage(const ImageInfo *,Image *);
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
93 % IsPCL() returns MagickTrue if the image format type, identified by the
94 % magick string, is PCL.
96 % The format of the IsPCL method is:
98 % MagickBooleanType IsPCL(const unsigned char *magick,const size_t length)
100 % A description of each parameter follows:
102 % o magick: compare image format pattern against these bytes.
104 % o length: Specifies the length of the magick string.
107 static MagickBooleanType IsPCL(const unsigned char *magick,const size_t length)
111 if (memcmp(magick,"\033E\033&",4) == 0)
113 if (memcmp(magick,"\033E\033",3) == 0)
119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123 % R e a d P C L I m a g e %
127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
129 % ReadPCLImage() reads a Printer Control Language image file and returns it.
130 % It allocates the memory necessary for the new Image structure and returns a
131 % pointer to the new image.
133 % The format of the ReadPCLImage method is:
135 % Image *ReadPCLImage(const ImageInfo *image_info,ExceptionInfo *exception)
137 % A description of each parameter follows:
139 % o image_info: the image info.
141 % o exception: return any errors or warnings in this structure.
144 static Image *ReadPCLImage(const ImageInfo *image_info,ExceptionInfo *exception)
146 #define CropBox "CropBox"
147 #define DeviceCMYK "DeviceCMYK"
148 #define MediaBox "MediaBox"
149 #define RenderPCLText " Rendering PCL... "
152 command[MaxTextExtent],
153 density[MaxTextExtent],
154 filename[MaxTextExtent],
155 geometry[MaxTextExtent],
156 options[MaxTextExtent],
157 input_filename[MaxTextExtent];
196 assert(image_info != (const ImageInfo *) NULL);
197 assert(image_info->signature == MagickSignature);
198 if (image_info->debug != MagickFalse)
199 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
200 image_info->filename);
201 assert(exception != (ExceptionInfo *) NULL);
202 assert(exception->signature == MagickSignature);
206 image=AcquireImage(image_info);
207 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
208 if (status == MagickFalse)
210 image=DestroyImageList(image);
211 return((Image *) NULL);
213 status=AcquireUniqueSymbolicLink(image_info->filename,input_filename);
214 if (status == MagickFalse)
216 ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile",
217 image_info->filename);
218 image=DestroyImageList(image);
219 return((Image *) NULL);
222 Set the page density.
224 delta.x=DefaultResolution;
225 delta.y=DefaultResolution;
226 if ((image->x_resolution == 0.0) || (image->y_resolution == 0.0))
234 flags=ParseGeometry(PSDensityGeometry,&geometry_info);
235 image->x_resolution=geometry_info.rho;
236 image->y_resolution=geometry_info.sigma;
237 if ((flags & SigmaValue) == 0)
238 image->y_resolution=image->x_resolution;
241 Determine page geometry from the PCL media box.
243 cmyk=image->colorspace == CMYKColorspace ? MagickTrue : MagickFalse;
245 (void) ResetMagickMemory(&bounding_box,0,sizeof(bounding_box));
246 (void) ResetMagickMemory(&bounds,0,sizeof(bounds));
247 (void) ResetMagickMemory(&page,0,sizeof(page));
248 (void) ResetMagickMemory(command,0,sizeof(command));
250 for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image))
252 if (image_info->page != (char *) NULL)
258 if ((c != (int) '/') && (c != '\n') &&
259 ((size_t) (p-command) < (MaxTextExtent-1)))
264 Is this a CMYK document?
266 if (LocaleNCompare(DeviceCMYK,command,strlen(DeviceCMYK)) == 0)
268 if (LocaleNCompare(CropBox,command,strlen(CropBox)) == 0)
271 Note region defined by crop box.
273 count=(ssize_t) sscanf(command,"CropBox [%lf %lf %lf %lf",
274 &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
276 count=(ssize_t) sscanf(command,"CropBox[%lf %lf %lf %lf",
277 &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
279 if (LocaleNCompare(MediaBox,command,strlen(MediaBox)) == 0)
282 Note region defined by media box.
284 count=(ssize_t) sscanf(command,"MediaBox [%lf %lf %lf %lf",
285 &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
287 count=(ssize_t) sscanf(command,"MediaBox[%lf %lf %lf %lf",
288 &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
293 Set PCL render geometry.
295 width=(size_t) floor(bounds.x2-bounds.x1+0.5);
296 height=(size_t) floor(bounds.y2-bounds.y1+0.5);
297 if (width > page.width)
299 if (height > page.height)
302 (void) CloseBlob(image);
304 Render PCL with the GhostPCL delegate.
306 if ((page.width == 0) || (page.height == 0))
307 (void) ParseAbsoluteGeometry(PSPageGeometry,&page);
308 if (image_info->page != (char *) NULL)
309 (void) ParseAbsoluteGeometry(image_info->page,&page);
310 (void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g",(double)
311 page.width,(double) page.height);
312 if (image_info->monochrome != MagickFalse)
313 delegate_info=GetDelegateInfo("pcl:mono",(char *) NULL,exception);
315 if (cmyk != MagickFalse)
316 delegate_info=GetDelegateInfo("pcl:cmyk",(char *) NULL,exception);
318 delegate_info=GetDelegateInfo("pcl:color",(char *) NULL,exception);
319 if (delegate_info == (const DelegateInfo *) NULL)
320 return((Image *) NULL);
322 if ((page.width == 0) || (page.height == 0))
323 (void) ParseAbsoluteGeometry(PSPageGeometry,&page);
324 if (image_info->page != (char *) NULL)
325 (void) ParseAbsoluteGeometry(image_info->page,&page);
326 (void) FormatLocaleString(density,MaxTextExtent,"%gx%g",
327 image->x_resolution,image->y_resolution);
328 page.width=(size_t) floor(page.width*image->x_resolution/delta.x+0.5);
329 page.height=(size_t) floor(page.height*image->y_resolution/delta.y+
331 (void) FormatLocaleString(options,MaxTextExtent,"-g%.20gx%.20g ",(double)
332 page.width,(double) page.height);
333 image=DestroyImage(image);
334 read_info=CloneImageInfo(image_info);
335 *read_info->magick='\0';
336 if (read_info->number_scenes != 0)
338 if (read_info->number_scenes != 1)
339 (void) FormatLocaleString(options,MaxTextExtent,"-dLastPage=%.20g",
340 (double) (read_info->scene+read_info->number_scenes));
342 (void) FormatLocaleString(options,MaxTextExtent,
343 "-dFirstPage=%.20g -dLastPage=%.20g",(double) read_info->scene+1,
344 (double) (read_info->scene+read_info->number_scenes));
345 read_info->number_scenes=0;
346 if (read_info->scenes != (char *) NULL)
347 *read_info->scenes='\0';
349 if (read_info->authenticate != (char *) NULL)
350 (void) FormatLocaleString(options+strlen(options),MaxTextExtent,
351 " -sPCLPassword=%s",read_info->authenticate);
352 (void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
353 (void) AcquireUniqueFilename(read_info->filename);
354 (void) FormatLocaleString(command,MaxTextExtent,
355 GetDelegateCommands(delegate_info),
356 read_info->antialias != MagickFalse ? 4 : 1,
357 read_info->antialias != MagickFalse ? 4 : 1,density,options,
358 read_info->filename,input_filename);
359 status=SystemCommand(MagickFalse,read_info->verbose,command,exception) != 0 ?
360 MagickTrue : MagickFalse;
361 image=ReadImage(read_info,exception);
362 (void) RelinquishUniqueFileResource(read_info->filename);
363 (void) RelinquishUniqueFileResource(input_filename);
364 read_info=DestroyImageInfo(read_info);
365 if (image == (Image *) NULL)
366 ThrowReaderException(DelegateError,"PCLDelegateFailed");
367 if (LocaleCompare(image->magick,"BMP") == 0)
372 cmyk_image=ConsolidateCMYKImages(image,&image->exception);
373 if (cmyk_image != (Image *) NULL)
375 image=DestroyImageList(image);
381 (void) CopyMagickString(image->filename,filename,MaxTextExtent);
383 next_image=SyncNextImageInList(image);
384 if (next_image != (Image *) NULL)
386 } while (next_image != (Image *) NULL);
387 return(GetFirstImageInList(image));
391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
395 % R e g i s t e r P C L I m a g e %
399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
401 % RegisterPCLImage() adds attributes for the PCL image format to
402 % the list of supported formats. The attributes include the image format
403 % tag, a method to read and/or write the format, whether the format
404 % supports the saving of more than one frame to the i file or blob,
405 % whether the format supports native in-memory I/O, and a brief
406 % description of the format.
408 % The format of the RegisterPCLImage method is:
410 % size_t RegisterPCLImage(void)
413 ModuleExport size_t RegisterPCLImage(void)
418 entry=SetMagickInfo("PCL");
419 entry->decoder=(DecodeImageHandler *) ReadPCLImage;
420 entry->encoder=(EncodeImageHandler *) WritePCLImage;
421 entry->magick=(IsImageFormatHandler *) IsPCL;
422 entry->blob_support=MagickFalse;
423 entry->seekable_stream=MagickTrue;
424 entry->thread_support=EncoderThreadSupport;
425 entry->description=ConstantString("Printer Control Language");
426 entry->module=ConstantString("PCL");
427 (void) RegisterMagickInfo(entry);
428 return(MagickImageCoderSignature);
432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
436 % U n r e g i s t e r P C L I m a g e %
440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
442 % UnregisterPCLImage() removes format registrations made by the PCL module
443 % from the list of supported formats.
445 % The format of the UnregisterPCLImage method is:
447 % UnregisterPCLImage(void)
450 ModuleExport void UnregisterPCLImage(void)
452 (void) UnregisterMagickInfo("PCL");
456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
460 % W r i t e P C L I m a g e %
464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
466 % WritePCLImage() writes an image in the Page Control Language encoded
469 % The format of the WritePCLImage method is:
471 % MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image)
473 % A description of each parameter follows.
475 % o image_info: the image info.
477 % o image: The image.
481 static size_t PCLDeltaCompressImage(const size_t length,
482 const unsigned char *previous_pixels,const unsigned char *pixels,
483 unsigned char *compress_pixels)
494 register unsigned char
498 for (x=0; x < (ssize_t) length; )
501 for (i=0; x < (ssize_t) length; x++)
503 if (*pixels++ != *previous_pixels++)
510 while (x < (ssize_t) length)
513 if (*pixels == *previous_pixels)
521 replacement=j >= 31 ? 31 : j;
523 delta=i >= 8 ? 8 : i;
524 *q++=(unsigned char) (((delta-1) << 5) | replacement);
525 if (replacement == 31)
527 for (replacement=255; j != 0; )
531 *q++=(unsigned char) replacement;
534 if (replacement == 255)
537 for (pixels-=i; i != 0; )
539 for (i-=delta; delta != 0; delta--)
546 *q++=(unsigned char) ((delta-1) << 5);
549 return((size_t) (q-compress_pixels));
552 static size_t PCLPackbitsCompressImage(const size_t length,
553 const unsigned char *pixels,unsigned char *compress_pixels)
561 register unsigned char
571 Compress pixels with Packbits encoding.
574 for (x=(ssize_t) length; x != 0; )
596 if ((*pixels == *(pixels+1)) && (*(pixels+1) == *(pixels+2)))
598 *q++=(unsigned char) ((256-3)+1);
610 if ((*pixels == *(pixels+1)) && (*(pixels+1) == *(pixels+2)))
616 while (((ssize_t) count < x) && (*pixels == *(pixels+count)))
623 *q++=(unsigned char) ((256-count)+1);
632 while ((*(pixels+count) != *(pixels+count+1)) ||
633 (*(pixels+count+1) != *(pixels+count+2)))
635 packbits[count+1]=pixels[count];
637 if (((ssize_t) count >= (x-3)) || (count >= 127))
641 *packbits=(unsigned char) (count-1);
642 for (j=0; j <= (ssize_t) count; j++)
649 *q++=128; /* EOD marker */
650 return((size_t) (q-compress_pixels));
653 static MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image)
656 buffer[MaxTextExtent];
667 register const Quantum *p;
669 register ssize_t i, x;
671 register unsigned char *q;
689 Open output image file.
691 assert(image_info != (const ImageInfo *) NULL);
692 assert(image_info->signature == MagickSignature);
693 assert(image != (Image *) NULL);
694 assert(image->signature == MagickSignature);
695 if (image->debug != MagickFalse)
696 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
697 status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
698 if (status == MagickFalse)
701 if (image_info->density != (char *) NULL)
706 (void) ParseGeometry(image_info->density,&geometry);
707 density=(size_t) geometry.rho;
713 if (image->colorspace != RGBColorspace)
714 (void) TransformImageColorspace(image,RGBColorspace);
716 Initialize the printer.
718 (void) WriteBlobString(image,"\033E"); /* printer reset */
719 (void) WriteBlobString(image,"\033*r3F"); /* set presentation mode */
720 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*r%.20gs%.20gT",
721 (double) image->columns,(double) image->rows);
722 (void) WriteBlobString(image,buffer);
723 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*t%.20gR",(double)
725 (void) WriteBlobString(image,buffer);
726 (void) WriteBlobString(image,"\033&l0E"); /* top margin 0 */
727 if (IsImageMonochrome(image,&image->exception) != MagickFalse)
730 Monochrome image: use default printer monochrome setup.
735 if (image->storage_class == DirectClass)
741 (void) WriteBlobString(image,"\033*v6W"); /* set color mode */
742 (void) WriteBlobByte(image,0); /* RGB */
743 (void) WriteBlobByte(image,3); /* direct by pixel */
744 (void) WriteBlobByte(image,0); /* bits per index (ignored) */
745 (void) WriteBlobByte(image,8); /* bits per red component */
746 (void) WriteBlobByte(image,8); /* bits per green component */
747 (void) WriteBlobByte(image,8); /* bits per blue component */
755 (void) WriteBlobString(image,"\033*v6W"); /* set color mode... */
756 (void) WriteBlobByte(image,0); /* RGB */
757 (void) WriteBlobByte(image,1); /* indexed by pixel */
758 (void) WriteBlobByte(image,bits_per_pixel); /* bits per index */
759 (void) WriteBlobByte(image,8); /* bits per red component */
760 (void) WriteBlobByte(image,8); /* bits per green component */
761 (void) WriteBlobByte(image,8); /* bits per blue component */
762 for (i=0; i < (ssize_t) image->colors; i++)
764 (void) FormatLocaleString(buffer,MaxTextExtent,
765 "\033*v%da%db%dc%.20gI",
766 ScaleQuantumToChar(image->colormap[i].red),
767 ScaleQuantumToChar(image->colormap[i].green),
768 ScaleQuantumToChar(image->colormap[i].blue),(double) i);
769 (void) WriteBlobString(image,buffer);
771 for (one=1; i < (ssize_t) (one << bits_per_pixel); i++)
773 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*v%.20gI",
775 (void) WriteBlobString(image,buffer);
778 option=GetImageOption(image_info,"pcl:fit-to-page");
779 if ((option != (const char *) NULL) &&
780 (IsMagickTrue(option) != MagickFalse))
781 (void) WriteBlobString(image,"\033*r3A");
783 (void) WriteBlobString(image,"\033*r1A"); /* start raster graphics */
784 (void) WriteBlobString(image,"\033*b0Y"); /* set y offset */
785 length=(image->columns*bits_per_pixel+7)/8;
786 pixels=(unsigned char *) AcquireQuantumMemory(length+1,sizeof(*pixels));
787 if (pixels == (unsigned char *) NULL)
788 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
789 (void) ResetMagickMemory(pixels,0,(length+1)*sizeof(*pixels));
790 compress_pixels=(unsigned char *) NULL;
791 previous_pixels=(unsigned char *) NULL;
792 switch (image->compression)
796 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*b0M");
797 (void) WriteBlobString(image,buffer);
802 compress_pixels=(unsigned char *) AcquireQuantumMemory(length+256,
803 sizeof(*compress_pixels));
804 if (compress_pixels == (unsigned char *) NULL)
806 pixels=(unsigned char *) RelinquishMagickMemory(pixels);
807 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
809 (void) ResetMagickMemory(compress_pixels,0,(length+256)*
810 sizeof(*compress_pixels));
811 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*b2M");
812 (void) WriteBlobString(image,buffer);
817 compress_pixels=(unsigned char *) AcquireQuantumMemory(3*length+256,
818 sizeof(*compress_pixels));
819 if (compress_pixels == (unsigned char *) NULL)
821 pixels=(unsigned char *) RelinquishMagickMemory(pixels);
822 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
824 (void) ResetMagickMemory(compress_pixels,0,(3*length+256)*
825 sizeof(*compress_pixels));
826 previous_pixels=(unsigned char *) AcquireQuantumMemory(length+1,
827 sizeof(*previous_pixels));
828 if (previous_pixels == (unsigned char *) NULL)
830 compress_pixels=(unsigned char *) RelinquishMagickMemory(
832 pixels=(unsigned char *) RelinquishMagickMemory(pixels);
833 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
835 (void) ResetMagickMemory(previous_pixels,0,(length+1)*
836 sizeof(*previous_pixels));
837 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*b3M");
838 (void) WriteBlobString(image,buffer);
842 for (y=0; y < (ssize_t) image->rows; y++)
844 p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
845 if (p == (const Quantum *) NULL)
848 switch (bits_per_pixel)
852 register unsigned char
861 for (x=0; x < (ssize_t) image->columns; x++)
864 if (GetPixelIntensity(image,p) < ((MagickRealType) QuantumRange/2.0))
873 p+=GetPixelChannels(image);
876 *q++=byte << (8-bit);
884 for (x=0; x < (ssize_t) image->columns; x++)
886 *q++=(unsigned char) GetPixelIndex(image,p);
887 p+=GetPixelChannels(image);
897 for (x=0; x < (ssize_t) image->columns; x++)
899 *q++=ScaleQuantumToChar(GetPixelRed(image,p));
900 *q++=ScaleQuantumToChar(GetPixelGreen(image,p));
901 *q++=ScaleQuantumToChar(GetPixelBlue(image,p));
902 p+=GetPixelChannels(image);
907 switch (image->compression)
911 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*b%.20gW",
913 (void) WriteBlobString(image,buffer);
914 (void) WriteBlob(image,length,pixels);
919 packets=PCLPackbitsCompressImage(length,pixels,compress_pixels);
920 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*b%.20gW",
922 (void) WriteBlobString(image,buffer);
923 (void) WriteBlob(image,packets,compress_pixels);
929 for (i=0; i < (ssize_t) length; i++)
930 previous_pixels[i]=(~pixels[i]);
931 packets=PCLDeltaCompressImage(length,previous_pixels,pixels,
933 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*b%.20gW",
935 (void) WriteBlobString(image,buffer);
936 (void) WriteBlob(image,packets,compress_pixels);
937 (void) CopyMagickMemory(previous_pixels,pixels,length*
943 (void) WriteBlobString(image,"\033*rB"); /* end graphics */
944 switch (image->compression)
950 compress_pixels=(unsigned char *) RelinquishMagickMemory(
956 previous_pixels=(unsigned char *) RelinquishMagickMemory(
958 compress_pixels=(unsigned char *) RelinquishMagickMemory(
963 pixels=(unsigned char *) RelinquishMagickMemory(pixels);
964 if (GetNextImageInList(image) == (Image *) NULL)
966 image=SyncNextImageInList(image);
967 status=SetImageProgress(image,SaveImagesTag,scene++,
968 GetImageListLength(image));
969 if (status == MagickFalse)
971 } while (image_info->adjoin != MagickFalse);
972 (void) WriteBlobString(image,"\033E");
973 (void) CloseBlob(image);