From: Cristy Date: Mon, 3 Apr 2017 21:21:42 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/417 X-Git-Tag: 7.0.5-5~54 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fc9742ced48e86336a410677933483176fb550da;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/417 --- diff --git a/coders/pdf.c b/coders/pdf.c index ff09d4ada..4ccd28088 100644 --- a/coders/pdf.c +++ b/coders/pdf.c @@ -2220,16 +2220,28 @@ RestoreMSCWarning (double) object); (void) WriteBlobString(image,buffer); (void) FormatLocaleString(buffer,MagickPathExtent,"<<\n/N %.20g\n" - "/Filter /ASCIIHexDecode\n/Length %.20g\n/Alternate /%s\n>>\n" - "stream\n",(double) channels,2.0*GetStringInfoLength(profile),device); + "/Filter /ASCII85Decode\n/Length %.20g 0 R\n/Alternate /%s\n>>\n" + "stream\n",(double) channels,(double) object+1,device); (void) WriteBlobString(image,buffer); + offset=TellBlob(image); + Ascii85Initialize(image); p=GetStringInfoDatum(profile); for (i=0; i < (ssize_t) GetStringInfoLength(profile); i++) - { - (void) FormatLocaleString(buffer,MagickPathExtent,"%02x",*p++); - (void) WriteBlobString(image,buffer); - } - (void) WriteBlobString(image,"\nendstream\n"); + Ascii85Encode(image,(unsigned char) *p++); + Ascii85Flush(image); + offset=TellBlob(image)-offset; + (void) WriteBlobString(image,"endstream\n"); + (void) WriteBlobString(image,"endobj\n"); + /* + Write Length object. + */ + xref[object++]=TellBlob(image); + (void) FormatLocaleString(buffer,MagickPathExtent,"%.20g 0 obj\n", + (double) object); + (void) WriteBlobString(image,buffer); + (void) FormatLocaleString(buffer,MagickPathExtent,"%.20g\n",(double) + offset); + (void) WriteBlobString(image,buffer); } (void) WriteBlobString(image,"endobj\n"); /* diff --git a/coders/yuv.c b/coders/yuv.c index 5a54cd82b..6ba57ecef 100644 --- a/coders/yuv.c +++ b/coders/yuv.c @@ -678,7 +678,7 @@ static MagickBooleanType WriteYUVImage(const ImageInfo *image_info,Image *image, exception); if (s == (const Quantum *) NULL) break; - for (x=0; x < (ssize_t) yuv_image->columns; x++) + for (x=0; x < (ssize_t) yuv_image->columns; x+=2) { if (quantum == 1) { @@ -706,7 +706,6 @@ static MagickBooleanType WriteYUVImage(const ImageInfo *image_info,Image *image, } p+=GetPixelChannels(yuv_image); s++; - x++; } if (image->previous == (Image *) NULL) {