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/colorspace-private.h"
51 #include "MagickCore/constitute.h"
52 #include "MagickCore/delegate.h"
53 #include "MagickCore/draw.h"
54 #include "MagickCore/exception.h"
55 #include "MagickCore/exception-private.h"
56 #include "MagickCore/geometry.h"
57 #include "MagickCore/image.h"
58 #include "MagickCore/image-private.h"
59 #include "MagickCore/list.h"
60 #include "MagickCore/magick.h"
61 #include "MagickCore/memory_.h"
62 #include "MagickCore/monitor.h"
63 #include "MagickCore/monitor-private.h"
64 #include "MagickCore/option.h"
65 #include "MagickCore/pixel-accessor.h"
66 #include "MagickCore/profile.h"
67 #include "MagickCore/property.h"
68 #include "MagickCore/resource_.h"
69 #include "MagickCore/quantum-private.h"
70 #include "MagickCore/static.h"
71 #include "MagickCore/string_.h"
72 #include "MagickCore/module.h"
73 #include "MagickCore/token.h"
74 #include "MagickCore/transform.h"
75 #include "MagickCore/utility.h"
80 static MagickBooleanType
81 WritePCLImage(const ImageInfo *,Image *,ExceptionInfo *);
84 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 % IsPCL() returns MagickTrue if the image format type, identified by the
95 % magick string, is PCL.
97 % The format of the IsPCL method is:
99 % MagickBooleanType IsPCL(const unsigned char *magick,const size_t length)
101 % A description of each parameter follows:
103 % o magick: compare image format pattern against these bytes.
105 % o length: Specifies the length of the magick string.
108 static MagickBooleanType IsPCL(const unsigned char *magick,const size_t length)
112 if (memcmp(magick,"\033E\033&",4) == 0)
114 if (memcmp(magick,"\033E\033",3) == 0)
120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124 % R e a d P C L I m a g e %
128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
130 % ReadPCLImage() reads a Printer Control Language image file and returns it.
131 % It allocates the memory necessary for the new Image structure and returns a
132 % pointer to the new image.
134 % The format of the ReadPCLImage method is:
136 % Image *ReadPCLImage(const ImageInfo *image_info,ExceptionInfo *exception)
138 % A description of each parameter follows:
140 % o image_info: the image info.
142 % o exception: return any errors or warnings in this structure.
145 static Image *ReadPCLImage(const ImageInfo *image_info,ExceptionInfo *exception)
147 #define CropBox "CropBox"
148 #define DeviceCMYK "DeviceCMYK"
149 #define MediaBox "MediaBox"
150 #define RenderPCLText " Rendering PCL... "
153 command[MaxTextExtent],
154 density[MaxTextExtent],
155 filename[MaxTextExtent],
156 geometry[MaxTextExtent],
157 options[MaxTextExtent],
158 input_filename[MaxTextExtent];
197 assert(image_info != (const ImageInfo *) NULL);
198 assert(image_info->signature == MagickSignature);
199 if (image_info->debug != MagickFalse)
200 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
201 image_info->filename);
202 assert(exception != (ExceptionInfo *) NULL);
203 assert(exception->signature == MagickSignature);
207 image=AcquireImage(image_info,exception);
208 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
209 if (status == MagickFalse)
211 image=DestroyImageList(image);
212 return((Image *) NULL);
214 status=AcquireUniqueSymbolicLink(image_info->filename,input_filename);
215 if (status == MagickFalse)
217 ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile",
218 image_info->filename);
219 image=DestroyImageList(image);
220 return((Image *) NULL);
223 Set the page density.
225 delta.x=DefaultResolution;
226 delta.y=DefaultResolution;
227 if ((image->x_resolution == 0.0) || (image->y_resolution == 0.0))
235 flags=ParseGeometry(PSDensityGeometry,&geometry_info);
236 image->x_resolution=geometry_info.rho;
237 image->y_resolution=geometry_info.sigma;
238 if ((flags & SigmaValue) == 0)
239 image->y_resolution=image->x_resolution;
242 Determine page geometry from the PCL media box.
244 cmyk=image->colorspace == CMYKColorspace ? MagickTrue : MagickFalse;
246 (void) ResetMagickMemory(&bounding_box,0,sizeof(bounding_box));
247 (void) ResetMagickMemory(&bounds,0,sizeof(bounds));
248 (void) ResetMagickMemory(&page,0,sizeof(page));
249 (void) ResetMagickMemory(command,0,sizeof(command));
251 for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image))
253 if (image_info->page != (char *) NULL)
259 if ((c != (int) '/') && (c != '\n') &&
260 ((size_t) (p-command) < (MaxTextExtent-1)))
265 Is this a CMYK document?
267 if (LocaleNCompare(DeviceCMYK,command,strlen(DeviceCMYK)) == 0)
269 if (LocaleNCompare(CropBox,command,strlen(CropBox)) == 0)
272 Note region defined by crop box.
274 count=(ssize_t) sscanf(command,"CropBox [%lf %lf %lf %lf",
275 &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
277 count=(ssize_t) sscanf(command,"CropBox[%lf %lf %lf %lf",
278 &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
280 if (LocaleNCompare(MediaBox,command,strlen(MediaBox)) == 0)
283 Note region defined by media box.
285 count=(ssize_t) sscanf(command,"MediaBox [%lf %lf %lf %lf",
286 &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
288 count=(ssize_t) sscanf(command,"MediaBox[%lf %lf %lf %lf",
289 &bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
294 Set PCL render geometry.
296 width=(size_t) floor(bounds.x2-bounds.x1+0.5);
297 height=(size_t) floor(bounds.y2-bounds.y1+0.5);
298 if (width > page.width)
300 if (height > page.height)
303 (void) CloseBlob(image);
305 Render PCL with the GhostPCL delegate.
307 if ((page.width == 0) || (page.height == 0))
308 (void) ParseAbsoluteGeometry(PSPageGeometry,&page);
309 if (image_info->page != (char *) NULL)
310 (void) ParseAbsoluteGeometry(image_info->page,&page);
311 (void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g",(double)
312 page.width,(double) page.height);
313 if (image_info->monochrome != MagickFalse)
314 delegate_info=GetDelegateInfo("pcl:mono",(char *) NULL,exception);
316 if (cmyk != MagickFalse)
317 delegate_info=GetDelegateInfo("pcl:cmyk",(char *) NULL,exception);
319 delegate_info=GetDelegateInfo("pcl:color",(char *) NULL,exception);
320 if (delegate_info == (const DelegateInfo *) NULL)
321 return((Image *) NULL);
323 if ((page.width == 0) || (page.height == 0))
324 (void) ParseAbsoluteGeometry(PSPageGeometry,&page);
325 if (image_info->page != (char *) NULL)
326 (void) ParseAbsoluteGeometry(image_info->page,&page);
327 (void) FormatLocaleString(density,MaxTextExtent,"%gx%g",
328 image->x_resolution,image->y_resolution);
329 page.width=(size_t) floor(page.width*image->x_resolution/delta.x+0.5);
330 page.height=(size_t) floor(page.height*image->y_resolution/delta.y+
332 (void) FormatLocaleString(options,MaxTextExtent,"-g%.20gx%.20g ",(double)
333 page.width,(double) page.height);
334 image=DestroyImage(image);
335 read_info=CloneImageInfo(image_info);
336 *read_info->magick='\0';
337 if (read_info->number_scenes != 0)
339 if (read_info->number_scenes != 1)
340 (void) FormatLocaleString(options,MaxTextExtent,"-dLastPage=%.20g",
341 (double) (read_info->scene+read_info->number_scenes));
343 (void) FormatLocaleString(options,MaxTextExtent,
344 "-dFirstPage=%.20g -dLastPage=%.20g",(double) read_info->scene+1,
345 (double) (read_info->scene+read_info->number_scenes));
346 read_info->number_scenes=0;
347 if (read_info->scenes != (char *) NULL)
348 *read_info->scenes='\0';
350 if (read_info->authenticate != (char *) NULL)
351 (void) FormatLocaleString(options+strlen(options),MaxTextExtent,
352 " -sPCLPassword=%s",read_info->authenticate);
353 (void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
354 (void) AcquireUniqueFilename(read_info->filename);
355 (void) FormatLocaleString(command,MaxTextExtent,
356 GetDelegateCommands(delegate_info),
357 read_info->antialias != MagickFalse ? 4 : 1,
358 read_info->antialias != MagickFalse ? 4 : 1,density,options,
359 read_info->filename,input_filename);
360 status=SystemCommand(MagickFalse,read_info->verbose,command,exception) != 0 ?
361 MagickTrue : MagickFalse;
362 image=ReadImage(read_info,exception);
363 (void) RelinquishUniqueFileResource(read_info->filename);
364 (void) RelinquishUniqueFileResource(input_filename);
365 read_info=DestroyImageInfo(read_info);
366 if (image == (Image *) NULL)
367 ThrowReaderException(DelegateError,"PCLDelegateFailed");
368 if (LocaleCompare(image->magick,"BMP") == 0)
373 cmyk_image=ConsolidateCMYKImages(image,&image->exception);
374 if (cmyk_image != (Image *) NULL)
376 image=DestroyImageList(image);
382 (void) CopyMagickString(image->filename,filename,MaxTextExtent);
384 next_image=SyncNextImageInList(image);
385 if (next_image != (Image *) NULL)
387 } while (next_image != (Image *) NULL);
388 return(GetFirstImageInList(image));
392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
396 % R e g i s t e r P C L I m a g e %
400 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
402 % RegisterPCLImage() adds attributes for the PCL image format to
403 % the list of supported formats. The attributes include the image format
404 % tag, a method to read and/or write the format, whether the format
405 % supports the saving of more than one frame to the i file or blob,
406 % whether the format supports native in-memory I/O, and a brief
407 % description of the format.
409 % The format of the RegisterPCLImage method is:
411 % size_t RegisterPCLImage(void)
414 ModuleExport size_t RegisterPCLImage(void)
419 entry=SetMagickInfo("PCL");
420 entry->decoder=(DecodeImageHandler *) ReadPCLImage;
421 entry->encoder=(EncodeImageHandler *) WritePCLImage;
422 entry->magick=(IsImageFormatHandler *) IsPCL;
423 entry->blob_support=MagickFalse;
424 entry->seekable_stream=MagickTrue;
425 entry->thread_support=EncoderThreadSupport;
426 entry->description=ConstantString("Printer Control Language");
427 entry->module=ConstantString("PCL");
428 (void) RegisterMagickInfo(entry);
429 return(MagickImageCoderSignature);
433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
437 % U n r e g i s t e r P C L I m a g e %
441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
443 % UnregisterPCLImage() removes format registrations made by the PCL module
444 % from the list of supported formats.
446 % The format of the UnregisterPCLImage method is:
448 % UnregisterPCLImage(void)
451 ModuleExport void UnregisterPCLImage(void)
453 (void) UnregisterMagickInfo("PCL");
457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
461 % W r i t e P C L I m a g e %
465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
467 % WritePCLImage() writes an image in the Page Control Language encoded
470 % The format of the WritePCLImage method is:
472 % MagickBooleanType WritePCLImage(const ImageInfo *image_info,
473 % Image *image,ExceptionInfo *exception)
475 % A description of each parameter follows.
477 % o image_info: the image info.
479 % o image: The image.
481 % o exception: return any errors or warnings in this structure.
485 static size_t PCLDeltaCompressImage(const size_t length,
486 const unsigned char *previous_pixels,const unsigned char *pixels,
487 unsigned char *compress_pixels)
498 register unsigned char
502 for (x=0; x < (ssize_t) length; )
505 for (i=0; x < (ssize_t) length; x++)
507 if (*pixels++ != *previous_pixels++)
514 while (x < (ssize_t) length)
517 if (*pixels == *previous_pixels)
525 replacement=j >= 31 ? 31 : j;
527 delta=i >= 8 ? 8 : i;
528 *q++=(unsigned char) (((delta-1) << 5) | replacement);
529 if (replacement == 31)
531 for (replacement=255; j != 0; )
535 *q++=(unsigned char) replacement;
538 if (replacement == 255)
541 for (pixels-=i; i != 0; )
543 for (i-=delta; delta != 0; delta--)
550 *q++=(unsigned char) ((delta-1) << 5);
553 return((size_t) (q-compress_pixels));
556 static size_t PCLPackbitsCompressImage(const size_t length,
557 const unsigned char *pixels,unsigned char *compress_pixels)
565 register unsigned char
575 Compress pixels with Packbits encoding.
578 for (x=(ssize_t) length; x != 0; )
600 if ((*pixels == *(pixels+1)) && (*(pixels+1) == *(pixels+2)))
602 *q++=(unsigned char) ((256-3)+1);
614 if ((*pixels == *(pixels+1)) && (*(pixels+1) == *(pixels+2)))
620 while (((ssize_t) count < x) && (*pixels == *(pixels+count)))
627 *q++=(unsigned char) ((256-count)+1);
636 while ((*(pixels+count) != *(pixels+count+1)) ||
637 (*(pixels+count+1) != *(pixels+count+2)))
639 packbits[count+1]=pixels[count];
641 if (((ssize_t) count >= (x-3)) || (count >= 127))
645 *packbits=(unsigned char) (count-1);
646 for (j=0; j <= (ssize_t) count; j++)
653 *q++=128; /* EOD marker */
654 return((size_t) (q-compress_pixels));
657 static MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image,
658 ExceptionInfo *exception)
661 buffer[MaxTextExtent];
672 register const Quantum *p;
674 register ssize_t i, x;
676 register unsigned char *q;
694 Open output image file.
696 assert(image_info != (const ImageInfo *) NULL);
697 assert(image_info->signature == MagickSignature);
698 assert(image != (Image *) NULL);
699 assert(image->signature == MagickSignature);
700 if (image->debug != MagickFalse)
701 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
702 assert(exception != (ExceptionInfo *) NULL);
703 assert(exception->signature == MagickSignature);
704 status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
705 if (status == MagickFalse)
708 if (image_info->density != (char *) NULL)
713 (void) ParseGeometry(image_info->density,&geometry);
714 density=(size_t) geometry.rho;
720 if (IsRGBColorspace(image->colorspace) == MagickFalse)
721 (void) TransformImageColorspace(image,RGBColorspace);
723 Initialize the printer.
725 (void) WriteBlobString(image,"\033E"); /* printer reset */
726 (void) WriteBlobString(image,"\033*r3F"); /* set presentation mode */
727 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*r%.20gs%.20gT",
728 (double) image->columns,(double) image->rows);
729 (void) WriteBlobString(image,buffer);
730 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*t%.20gR",(double)
732 (void) WriteBlobString(image,buffer);
733 (void) WriteBlobString(image,"\033&l0E"); /* top margin 0 */
734 if (IsImageMonochrome(image,exception) != MagickFalse)
737 Monochrome image: use default printer monochrome setup.
742 if (image->storage_class == DirectClass)
748 (void) WriteBlobString(image,"\033*v6W"); /* set color mode */
749 (void) WriteBlobByte(image,0); /* RGB */
750 (void) WriteBlobByte(image,3); /* direct by pixel */
751 (void) WriteBlobByte(image,0); /* bits per index (ignored) */
752 (void) WriteBlobByte(image,8); /* bits per red component */
753 (void) WriteBlobByte(image,8); /* bits per green component */
754 (void) WriteBlobByte(image,8); /* bits per blue component */
762 (void) WriteBlobString(image,"\033*v6W"); /* set color mode... */
763 (void) WriteBlobByte(image,0); /* RGB */
764 (void) WriteBlobByte(image,1); /* indexed by pixel */
765 (void) WriteBlobByte(image,bits_per_pixel); /* bits per index */
766 (void) WriteBlobByte(image,8); /* bits per red component */
767 (void) WriteBlobByte(image,8); /* bits per green component */
768 (void) WriteBlobByte(image,8); /* bits per blue component */
769 for (i=0; i < (ssize_t) image->colors; i++)
771 (void) FormatLocaleString(buffer,MaxTextExtent,
772 "\033*v%da%db%dc%.20gI",
773 ScaleQuantumToChar(image->colormap[i].red),
774 ScaleQuantumToChar(image->colormap[i].green),
775 ScaleQuantumToChar(image->colormap[i].blue),(double) i);
776 (void) WriteBlobString(image,buffer);
778 for (one=1; i < (ssize_t) (one << bits_per_pixel); i++)
780 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*v%.20gI",
782 (void) WriteBlobString(image,buffer);
785 option=GetImageOption(image_info,"pcl:fit-to-page");
786 if ((option != (const char *) NULL) &&
787 (IsMagickTrue(option) != MagickFalse))
788 (void) WriteBlobString(image,"\033*r3A");
790 (void) WriteBlobString(image,"\033*r1A"); /* start raster graphics */
791 (void) WriteBlobString(image,"\033*b0Y"); /* set y offset */
792 length=(image->columns*bits_per_pixel+7)/8;
793 pixels=(unsigned char *) AcquireQuantumMemory(length+1,sizeof(*pixels));
794 if (pixels == (unsigned char *) NULL)
795 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
796 (void) ResetMagickMemory(pixels,0,(length+1)*sizeof(*pixels));
797 compress_pixels=(unsigned char *) NULL;
798 previous_pixels=(unsigned char *) NULL;
799 switch (image->compression)
803 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*b0M");
804 (void) WriteBlobString(image,buffer);
809 compress_pixels=(unsigned char *) AcquireQuantumMemory(length+256,
810 sizeof(*compress_pixels));
811 if (compress_pixels == (unsigned char *) NULL)
813 pixels=(unsigned char *) RelinquishMagickMemory(pixels);
814 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
816 (void) ResetMagickMemory(compress_pixels,0,(length+256)*
817 sizeof(*compress_pixels));
818 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*b2M");
819 (void) WriteBlobString(image,buffer);
824 compress_pixels=(unsigned char *) AcquireQuantumMemory(3*length+256,
825 sizeof(*compress_pixels));
826 if (compress_pixels == (unsigned char *) NULL)
828 pixels=(unsigned char *) RelinquishMagickMemory(pixels);
829 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
831 (void) ResetMagickMemory(compress_pixels,0,(3*length+256)*
832 sizeof(*compress_pixels));
833 previous_pixels=(unsigned char *) AcquireQuantumMemory(length+1,
834 sizeof(*previous_pixels));
835 if (previous_pixels == (unsigned char *) NULL)
837 compress_pixels=(unsigned char *) RelinquishMagickMemory(
839 pixels=(unsigned char *) RelinquishMagickMemory(pixels);
840 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
842 (void) ResetMagickMemory(previous_pixels,0,(length+1)*
843 sizeof(*previous_pixels));
844 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*b3M");
845 (void) WriteBlobString(image,buffer);
849 for (y=0; y < (ssize_t) image->rows; y++)
851 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
852 if (p == (const Quantum *) NULL)
855 switch (bits_per_pixel)
859 register unsigned char
868 for (x=0; x < (ssize_t) image->columns; x++)
871 if (GetPixelIntensity(image,p) < ((MagickRealType) QuantumRange/2.0))
880 p+=GetPixelChannels(image);
883 *q++=byte << (8-bit);
891 for (x=0; x < (ssize_t) image->columns; x++)
893 *q++=(unsigned char) GetPixelIndex(image,p);
894 p+=GetPixelChannels(image);
904 for (x=0; x < (ssize_t) image->columns; x++)
906 *q++=ScaleQuantumToChar(GetPixelRed(image,p));
907 *q++=ScaleQuantumToChar(GetPixelGreen(image,p));
908 *q++=ScaleQuantumToChar(GetPixelBlue(image,p));
909 p+=GetPixelChannels(image);
914 switch (image->compression)
918 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*b%.20gW",
920 (void) WriteBlobString(image,buffer);
921 (void) WriteBlob(image,length,pixels);
926 packets=PCLPackbitsCompressImage(length,pixels,compress_pixels);
927 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*b%.20gW",
929 (void) WriteBlobString(image,buffer);
930 (void) WriteBlob(image,packets,compress_pixels);
936 for (i=0; i < (ssize_t) length; i++)
937 previous_pixels[i]=(~pixels[i]);
938 packets=PCLDeltaCompressImage(length,previous_pixels,pixels,
940 (void) FormatLocaleString(buffer,MaxTextExtent,"\033*b%.20gW",
942 (void) WriteBlobString(image,buffer);
943 (void) WriteBlob(image,packets,compress_pixels);
944 (void) CopyMagickMemory(previous_pixels,pixels,length*
950 (void) WriteBlobString(image,"\033*rB"); /* end graphics */
951 switch (image->compression)
957 compress_pixels=(unsigned char *) RelinquishMagickMemory(
963 previous_pixels=(unsigned char *) RelinquishMagickMemory(
965 compress_pixels=(unsigned char *) RelinquishMagickMemory(
970 pixels=(unsigned char *) RelinquishMagickMemory(pixels);
971 if (GetNextImageInList(image) == (Image *) NULL)
973 image=SyncNextImageInList(image);
974 status=SetImageProgress(image,SaveImagesTag,scene++,
975 GetImageListLength(image));
976 if (status == MagickFalse)
978 } while (image_info->adjoin != MagickFalse);
979 (void) WriteBlobString(image,"\033E");
980 (void) CloseBlob(image);