% July 1992 %
% %
% %
-% Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
#include "magick/string_.h"
#include "magick/module.h"
#include "magick/utility.h"
+\f
+/*
+ Define declarations.
+*/
#if defined(MAGICKCORE_TIFF_DELEGATE)
-#if defined(MAGICKCORE_HAVE_TIFFCONF_H)
-#include "tiffconf.h"
-#endif
-#include "tiffio.h"
#define CCITTParam "-1"
#else
#define CCITTParam "0"
%
% The format of the RegisterPS2Image method is:
%
-% unsigned long RegisterPS2Image(void)
+% size_t RegisterPS2Image(void)
%
*/
-ModuleExport unsigned long RegisterPS2Image(void)
+ModuleExport size_t RegisterPS2Image(void)
{
MagickInfo
*entry;
%
*/
-#if defined(MAGICKCORE_TIFF_DELEGATE)
static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
Image *image,Image *inject_image)
{
- char
- filename[MaxTextExtent];
-
- FILE
- *file;
-
Image
- *huffman_image;
+ *group4_image;
ImageInfo
*write_info;
- int
- unique_file;
-
MagickBooleanType
status;
- register long
- i;
-
- ssize_t
- count;
-
- TIFF
- *tiff;
-
- uint16
- fillorder;
-
- uint32
- *byte_count,
- strip_size;
+ size_t
+ length;
unsigned char
- *buffer;
+ *group4;
- /*
- Write image as CCITTFax4 TIFF image to a temporary file.
- */
- assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
- assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- assert(inject_image != (Image *) NULL);
- assert(inject_image->signature == MagickSignature);
- huffman_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
- if (huffman_image == (Image *) NULL)
- return(MagickFalse);
- file=(FILE *) NULL;
- unique_file=AcquireUniqueFileResource(filename);
- if (unique_file != -1)
- file=fdopen(unique_file,"wb");
- if ((unique_file == -1) || (file == (FILE *) NULL))
- {
- ThrowFileException(&image->exception,FileOpenError,
- "UnableToCreateTemporaryFile",filename);
- return(MagickFalse);
- }
- (void) FormatMagickString(huffman_image->filename,MaxTextExtent,"tiff:%s",
- filename);
+ status=MagickTrue;
write_info=CloneImageInfo(image_info);
- SetImageInfoFile(write_info,file);
- write_info->compression=Group4Compression;
- write_info->type=BilevelType;
- (void) SetImageOption(write_info,"quantum:polarity","min-is-white");
- status=WriteImage(write_info,huffman_image);
- (void) fflush(file);
- write_info=DestroyImageInfo(write_info);
- if (status == MagickFalse)
+ (void) CopyMagickString(write_info->filename,"GROUP4:",MaxTextExtent);
+ (void) CopyMagickString(write_info->magick,"GROUP4",MaxTextExtent);
+ group4_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
+ if (group4_image == (Image *) NULL)
return(MagickFalse);
- tiff=TIFFOpen(filename,"rb");
- if (tiff == (TIFF *) NULL)
- {
- huffman_image=DestroyImage(huffman_image);
- (void) fclose(file);
- (void) RelinquishUniqueFileResource(filename);
- ThrowFileException(&image->exception,FileOpenError,"UnableToOpenFile",
- image_info->filename);
- return(MagickFalse);
- }
- /*
- Allocate raw strip buffer.
- */
- byte_count=0;
- (void) TIFFGetField(tiff,TIFFTAG_STRIPBYTECOUNTS,&byte_count);
- strip_size=byte_count[0];
- for (i=1; i < (long) TIFFNumberOfStrips(tiff); i++)
- if (byte_count[i] > strip_size)
- strip_size=byte_count[i];
- buffer=(unsigned char *) AcquireQuantumMemory((size_t) strip_size,
- sizeof(*buffer));
- if (buffer == (unsigned char *) NULL)
- {
- TIFFClose(tiff);
- huffman_image=DestroyImage(huffman_image);
- (void) fclose(file);
- (void) RelinquishUniqueFileResource(filename);
- ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
- image_info->filename);
- }
- /*
- Compress runlength encoded to 2D Huffman pixels.
- */
- fillorder=FILLORDER_LSB2MSB;
- (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&fillorder);
- for (i=0; i < (long) TIFFNumberOfStrips(tiff); i++)
- {
- count=(ssize_t) TIFFReadRawStrip(tiff,(uint32) i,buffer,(long)
- byte_count[i]);
- if (fillorder == FILLORDER_LSB2MSB)
- TIFFReverseBits(buffer,(unsigned long) count);
- (void) WriteBlob(image,(size_t) count,buffer);
- }
- buffer=(unsigned char *) RelinquishMagickMemory(buffer);
- TIFFClose(tiff);
- huffman_image=DestroyImage(huffman_image);
- (void) fclose(file);
- (void) RelinquishUniqueFileResource(filename);
- return(MagickTrue);
-}
-#else
-static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
- Image *image,Image *inject_image)
-{
- assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
- assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- assert(inject_image != (Image *) NULL);
- assert(inject_image->signature == MagickSignature);
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
- MissingDelegateError,"DelegateLibrarySupportNotBuiltIn","`%s' (TIFF)",
- image->filename);
- return(MagickFalse);
+ group4=(unsigned char *) ImageToBlob(write_info,group4_image,&length,
+ &image->exception);
+ group4_image=DestroyImage(group4_image);
+ if (group4 == (unsigned char *) NULL)
+ return(MagickFalse);
+ write_info=DestroyImageInfo(write_info);
+ if (WriteBlob(image,length,group4) != (ssize_t) length)
+ status=MagickFalse;
+ group4=(unsigned char *) RelinquishMagickMemory(group4);
+ return(status);
}
-#endif
static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image)
{
" /Decode [0 1 0 1 0 1]",
" /ImageMatrix [columns 0 0 rows neg 0 rows]",
" compression 0 gt",
- " { /DataSource pixel_stream /%s filter }",
- " { /DataSource pixel_stream /%s filter } ifelse",
+ " { /DataSource pixel_stream %s }",
+ " { /DataSource pixel_stream %s } ifelse",
" >> image",
" }",
" {",
" /Decode [1 0 1 0 1 0 1 0]",
" /ImageMatrix [columns 0 0 rows neg 0 rows]",
" compression 0 gt",
- " { /DataSource pixel_stream /%s filter }",
- " { /DataSource pixel_stream /%s filter } ifelse",
+ " { /DataSource pixel_stream %s }",
+ " { /DataSource pixel_stream %s } ifelse",
" >> image",
" } ifelse",
"} bind def",
" /Decode [0 1]",
" /ImageMatrix [columns 0 0 rows neg 0 rows]",
" compression 0 gt",
- " { /DataSource pixel_stream /%s filter }",
+ " { /DataSource pixel_stream %s }",
" {",
- " /DataSource pixel_stream /%s filter",
+ " /DataSource pixel_stream %s",
" <<",
" /K "CCITTParam,
" /Columns columns",
" /Decode [0 255]",
" /ImageMatrix [columns 0 0 rows neg 0 rows]",
" compression 0 gt",
- " { /DataSource pixel_stream /%s filter }",
- " { /DataSource pixel_stream /%s filter } ifelse",
+ " { /DataSource pixel_stream %s }",
+ " { /DataSource pixel_stream %s } ifelse",
" >> image",
" } ifelse",
"} bind def",
GeometryInfo
geometry_info;
- long
+ ssize_t
j,
y;
register const PixelPacket
*p;
- register long
+ register ssize_t
x;
- register long
+ register ssize_t
i;
SegmentInfo
unsigned char
*pixels;
- unsigned long
+ size_t
page,
text_size;
}
if (image->units == PixelsPerCentimeterResolution)
{
- resolution.x*=2.54;
- resolution.y*=2.54;
+ resolution.x=(size_t) (100.0*2.54*resolution.x+0.5)/100.0;
+ resolution.y=(size_t) (100.0*2.54*resolution.y+0.5)/100.0;
}
SetGeometry(image,&geometry);
- (void) FormatMagickString(page_geometry,MaxTextExtent,"%lux%lu",
- image->columns,image->rows);
+ (void) FormatMagickString(page_geometry,MaxTextExtent,"%.20gx%.20g",
+ (double) image->columns,(double) image->rows);
if (image_info->page != (char *) NULL)
(void) CopyMagickString(page_geometry,image_info->page,MaxTextExtent);
else
if ((image->page.width != 0) && (image->page.height != 0))
- (void) FormatMagickString(page_geometry,MaxTextExtent,"%lux%lu%+ld%+ld",
- image->page.width,image->page.height,image->page.x,image->page.y);
+ (void) FormatMagickString(page_geometry,MaxTextExtent,
+ "%.20gx%.20g%+.20g%+.20g",(double) image->page.width,(double)
+ image->page.height,(double) image->page.x,(double) image->page.y);
else
if ((image->gravity != UndefinedGravity) &&
(LocaleCompare(image_info->magick,"PS") == 0))
(void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y,
&geometry.width,&geometry.height);
scale.x=(double) (geometry.width*delta.x)/resolution.x;
- geometry.width=(unsigned long) (scale.x+0.5);
+ geometry.width=(size_t) floor(scale.x+0.5);
scale.y=(double) (geometry.height*delta.y)/resolution.y;
- geometry.height=(unsigned long) (scale.y+0.5);
+ geometry.height=(size_t) floor(scale.y+0.5);
(void) ParseAbsoluteGeometry(page_geometry,&media_info);
(void) ParseGravityGeometry(image,page_geometry,&page_info,
&image->exception);
if (image->gravity != UndefinedGravity)
{
geometry.x=(-page_info.x);
- geometry.y=(long) (media_info.height+page_info.y-image->rows);
+ geometry.y=(ssize_t) (media_info.height+page_info.y-image->rows);
}
pointsize=12.0;
if (image_info->pointsize != 0.0)
text_size=0;
value=GetImageProperty(image,"label");
if (value != (const char *) NULL)
- text_size=(unsigned long) (MultilineCensus(value)*pointsize+12);
+ text_size=(size_t) (MultilineCensus(value)*pointsize+12);
if (page == 1)
{
/*
else
{
(void) FormatMagickString(buffer,MaxTextExtent,
- "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) (bounds.x1+0.5),
- (long) (bounds.y1+0.5),
- (long) (bounds.x2+0.5),(long) (bounds.y2+0.5));
+ "%%%%BoundingBox: %.20g %.20g %.20g %.20g\n",ceil(bounds.x1-0.5),
+ ceil(bounds.y1-0.5),floor(bounds.x2+0.5),floor(bounds.y2+0.5));
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,
- "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,
- bounds.x2,bounds.y2);
+ "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,
+ bounds.y1,bounds.x2,bounds.y2);
}
(void) WriteBlobString(image,buffer);
value=GetImageProperty(image,"label");
if (image_info->adjoin == MagickFalse)
(void) CopyMagickString(buffer,"%%Pages: 1\n",MaxTextExtent);
else
- (void) FormatMagickString(buffer,MaxTextExtent,"%%%%Pages: %lu\n",
- (unsigned long) GetImageListLength(image));
+ (void) FormatMagickString(buffer,MaxTextExtent,
+ "%%%%Pages: %.20g\n",(double) GetImageListLength(image));
(void) WriteBlobString(image,buffer);
}
(void) WriteBlobString(image,"%%EndComments\n");
case NoCompression:
{
(void) FormatMagickString(buffer,MaxTextExtent,*q,
- "ASCII85Decode");
+ "/ASCII85Decode filter");
break;
}
case JPEGCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,*q,"DCTDecode");
+ (void) FormatMagickString(buffer,MaxTextExtent,*q,
+ "/DCTDecode filter");
break;
}
case LZWCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,*q,"LZWDecode");
+ (void) FormatMagickString(buffer,MaxTextExtent,*q,
+ "/LZWDecode filter");
break;
}
case FaxCompression:
case Group4Compression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,*q,
- "ASCII85Decode");
+ (void) FormatMagickString(buffer,MaxTextExtent,*q," ");
break;
}
default:
{
(void) FormatMagickString(buffer,MaxTextExtent,*q,
- "RunLengthDecode");
+ "/RunLengthDecode filter");
break;
}
}
}
value=GetImageProperty(image,"label");
if (value != (const char *) NULL)
- for (j=(long) MultilineCensus(value)-1; j >= 0; j--)
+ for (j=(ssize_t) MultilineCensus(value)-1; j >= 0; j--)
{
(void) WriteBlobString(image," /label 512 string def\n");
(void) WriteBlobString(image," currentfile label readline pop\n");
(void) WriteBlobString(image,"} bind def\n");
(void) WriteBlobString(image,"%%EndProlog\n");
}
- (void) FormatMagickString(buffer,MaxTextExtent,"%%%%Page: 1 %lu\n",page++);
+ (void) FormatMagickString(buffer,MaxTextExtent,"%%%%Page: 1 %.20g\n",
+ (double) page++);
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,
- "%%%%PageBoundingBox: %ld %ld %ld %ld\n",geometry.x,geometry.y,
- geometry.x+(long) geometry.width,geometry.y+(long)
+ "%%%%PageBoundingBox: %.20g %.20g %.20g %.20g\n",(double) geometry.x,
+ (double) geometry.y,geometry.x+(double) geometry.width,geometry.y+(double)
(geometry.height+text_size));
(void) WriteBlobString(image,buffer);
if ((double) geometry.x < bounds.x1)
/*
Output image data.
*/
- (void) FormatMagickString(buffer,MaxTextExtent,"%ld %ld\n%g %g\n%f\n",
- geometry.x,geometry.y,scale.x,scale.y,pointsize);
+ (void) FormatMagickString(buffer,MaxTextExtent,"%.20g %.20g\n%g %g\n%g\n",
+ (double) geometry.x,(double) geometry.y,scale.x,scale.y,pointsize);
(void) WriteBlobString(image,buffer);
labels=(char **) NULL;
value=GetImageProperty(image,"label");
((image_info->type != TrueColorType) &&
(IsGrayImage(image,&image->exception) != MagickFalse)))
{
- (void) FormatMagickString(buffer,MaxTextExtent,"%lu %lu\n1\n%d\n",
- image->columns,image->rows,(int)
+ (void) FormatMagickString(buffer,MaxTextExtent,"%.20g %.20g\n1\n%d\n",
+ (double) image->columns,(double) image->rows,(int)
(image->colorspace == CMYKColorspace));
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,"%d\n",
Dump Runlength encoded pixels.
*/
q=pixels;
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,
&image->exception);
if (p == (const PixelPacket *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
*q++=ScaleQuantumToChar(PixelIntensityToQuantum(p));
p++;
}
- progress=SetImageProgress(image,SaveImageTag,y,image->rows);
+ progress=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,image->rows);
if (progress == MagickFalse)
break;
}
Dump uncompressed PseudoColor packets.
*/
Ascii85Initialize(image);
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,
&image->exception);
if (p == (const PixelPacket *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
Ascii85Encode(image,
ScaleQuantumToChar(PixelIntensityToQuantum(p)));
p++;
}
- progress=SetImageProgress(image,SaveImageTag,y,image->rows);
+ progress=SetImageProgress(image,SaveImageTag,(MagickOffsetType)
+ y,image->rows);
if (progress == MagickFalse)
break;
}
if ((image->storage_class == DirectClass) || (image->colors > 256) ||
(compression == JPEGCompression) || (image->matte != MagickFalse))
{
- (void) FormatMagickString(buffer,MaxTextExtent,"%lu %lu\n0\n%d\n",
- image->columns,image->rows,(int)
+ (void) FormatMagickString(buffer,MaxTextExtent,"%.20g %.20g\n0\n%d\n",
+ (double) image->columns,(double) image->rows,(int)
(image->colorspace == CMYKColorspace));
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,"%d\n",
Dump Packbit encoded pixels.
*/
q=pixels;
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,
&image->exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(image);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if ((image->matte != MagickFalse) &&
(p->opacity == (Quantum) TransparentOpacity))
else
if (image->colorspace != CMYKColorspace)
{
- *q++=ScaleQuantumToChar(p->red);
- *q++=ScaleQuantumToChar(p->green);
- *q++=ScaleQuantumToChar(p->blue);
+ *q++=ScaleQuantumToChar(GetRedPixelComponent(p));
+ *q++=ScaleQuantumToChar(GetGreenPixelComponent(p));
+ *q++=ScaleQuantumToChar(GetBluePixelComponent(p));
}
else
{
- *q++=ScaleQuantumToChar(p->red);
- *q++=ScaleQuantumToChar(p->green);
- *q++=ScaleQuantumToChar(p->blue);
+ *q++=ScaleQuantumToChar(GetRedPixelComponent(p));
+ *q++=ScaleQuantumToChar(GetGreenPixelComponent(p));
+ *q++=ScaleQuantumToChar(GetBluePixelComponent(p));
*q++=ScaleQuantumToChar(indexes[x]);
}
p++;
}
- progress=SetImageProgress(image,SaveImageTag,y,image->rows);
+ progress=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,image->rows);
if (progress == MagickFalse)
break;
}
Dump uncompressed DirectColor packets.
*/
Ascii85Initialize(image);
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,
&image->exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(image);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if ((image->matte != MagickFalse) &&
(p->opacity == (Quantum) TransparentOpacity))
else
if (image->colorspace != CMYKColorspace)
{
- Ascii85Encode(image,ScaleQuantumToChar(p->red));
- Ascii85Encode(image,ScaleQuantumToChar(p->green));
- Ascii85Encode(image,ScaleQuantumToChar(p->blue));
+ Ascii85Encode(image,ScaleQuantumToChar(GetRedPixelComponent(p)));
+ Ascii85Encode(image,ScaleQuantumToChar(GetGreenPixelComponent(p)));
+ Ascii85Encode(image,ScaleQuantumToChar(GetBluePixelComponent(p)));
}
else
{
- Ascii85Encode(image,ScaleQuantumToChar(p->red));
- Ascii85Encode(image,ScaleQuantumToChar(p->green));
- Ascii85Encode(image,ScaleQuantumToChar(p->blue));
+ Ascii85Encode(image,ScaleQuantumToChar(GetRedPixelComponent(p)));
+ Ascii85Encode(image,ScaleQuantumToChar(GetGreenPixelComponent(p)));
+ Ascii85Encode(image,ScaleQuantumToChar(GetBluePixelComponent(p)));
Ascii85Encode(image,ScaleQuantumToChar(indexes[x]));
}
p++;
}
- progress=SetImageProgress(image,SaveImageTag,y,image->rows);
+ progress=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,image->rows);
if (progress == MagickFalse)
break;
}
/*
Dump number of colors and colormap.
*/
- (void) FormatMagickString(buffer,MaxTextExtent,"%lu %lu\n1\n%d\n",
- image->columns,image->rows,(int)
+ (void) FormatMagickString(buffer,MaxTextExtent,"%.20g %.20g\n1\n%d\n",
+ (double) image->columns,(double) image->rows,(int)
(image->colorspace == CMYKColorspace));
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,"%d\n",
(int) (compression == NoCompression));
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"%lu\n",image->colors);
+ (void) FormatMagickString(buffer,MaxTextExtent,"%.20g\n",(double)
+ image->colors);
(void) WriteBlobString(image,buffer);
- for (i=0; i < (long) image->colors; i++)
+ for (i=0; i < (ssize_t) image->colors; i++)
{
(void) FormatMagickString(buffer,MaxTextExtent,"%02X%02X%02X\n",
ScaleQuantumToChar(image->colormap[i].red),
Dump Runlength encoded pixels.
*/
q=pixels;
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,
&image->exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(image);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
*q++=(unsigned char) indexes[x];
- progress=SetImageProgress(image,SaveImageTag,y,image->rows);
+ progress=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,image->rows);
if (progress == MagickFalse)
break;
}
Dump uncompressed PseudoColor packets.
*/
Ascii85Initialize(image);
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,
&image->exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(image);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
Ascii85Encode(image,(unsigned char) indexes[x]);
- progress=SetImageProgress(image,SaveImageTag,y,image->rows);
+ progress=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,image->rows);
if (progress == MagickFalse)
break;
}
if (page > 1)
{
(void) FormatMagickString(buffer,MaxTextExtent,
- "%%%%BoundingBox: %ld %ld %ld %ld\n",(long) (bounds.x1+0.5),
- (long) (bounds.y1+0.5),(long) (bounds.x2+0.5),(long) (bounds.y2+0.5));
+ "%%%%BoundingBox: %.20g %.20g %.20g %.20g\n",ceil(bounds.x1-0.5),
+ ceil(bounds.y1-0.5),floor(bounds.x2+0.5),floor(bounds.y2+0.5));
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,
- "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,bounds.x2,
- bounds.y2);
+ "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,
+ bounds.x2,bounds.y2);
(void) WriteBlobString(image,buffer);
}
(void) WriteBlobString(image,"%%EOF\n");