From: cristy Date: Sat, 24 Apr 2010 23:45:19 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~9586 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0881b52ab4fee8427578a694081946c4c4e92b35;p=imagemagick --- diff --git a/coders/jbig.c b/coders/jbig.c index fad10b6ae..bd3d79edc 100644 --- a/coders/jbig.c +++ b/coders/jbig.c @@ -524,8 +524,8 @@ static MagickBooleanType WriteJBIGImage(const ImageInfo *image_info, } if (image->units == PixelsPerCentimeterResolution) { - x_resolution*=2.54; - y_resolution*=2.54; + x_resolution=(unsigned long) (100.0*2.54*x_resolution+0.5)/100.0; + y_resolution=(unsigned long) (100.0*2.54*y_resolution+0.5)/100.0; } (void) jbg_enc_lrlmax(&jbig_info,x_resolution,y_resolution); } diff --git a/coders/pdf.c b/coders/pdf.c index 6fcd1c358..82e8ce815 100644 --- a/coders/pdf.c +++ b/coders/pdf.c @@ -1253,8 +1253,8 @@ static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image) } if (image->units == PixelsPerCentimeterResolution) { - resolution.x*=2.54; - resolution.y*=2.54; + resolution.x=(unsigned long) (100.0*2.54*resolution.x+0.5)/100.0; + resolution.y=(unsigned long) (100.0*2.54*resolution.y+0.5)/100.0; } SetGeometry(image,&geometry); (void) FormatMagickString(page_geometry,MaxTextExtent,"%lux%lu", diff --git a/coders/png.c b/coders/png.c index e5b0fddda..da218bb4c 100644 --- a/coders/png.c +++ b/coders/png.c @@ -2044,9 +2044,9 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, Set image resolution. */ (void) png_get_pHYs(ping,ping_info,&x_resolution,&y_resolution, - &unit_type); - image->x_resolution=(float) x_resolution; - image->y_resolution=(float) y_resolution; + &unit_type); + image->x_resolution=(double) x_resolution; + image->y_resolution=(double) y_resolution; if (unit_type == PNG_RESOLUTION_METER) { image->units=PixelsPerCentimeterResolution; @@ -2056,8 +2056,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Reading PNG pHYs chunk: xres: %lu, yres: %lu, units: %d.", - (unsigned long) x_resolution, (unsigned long) y_resolution, - unit_type); + (unsigned long) x_resolution,(unsigned long) y_resolution,unit_type); } #endif if (png_get_valid(ping,ping_info,PNG_INFO_PLTE)) @@ -9178,7 +9177,7 @@ static MagickBooleanType WriteMNGImage(const ImageInfo *image_info,Image *image) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " TERM delay: %lu", - (png_uint_32) (mng_info->ticks_per_second* + (unsigned long) (mng_info->ticks_per_second* final_delay/MagickMax(image->ticks_per_second,1))); if (image->iterations == 0) (void) LogMagickEvent(CoderEvent,GetMagickModule(), diff --git a/coders/ps.c b/coders/ps.c index 47767da6b..073cba852 100644 --- a/coders/ps.c +++ b/coders/ps.c @@ -1422,8 +1422,8 @@ static MagickBooleanType WritePSImage(const ImageInfo *image_info,Image *image) } if (image->units == PixelsPerCentimeterResolution) { - resolution.x*=2.54; - resolution.y*=2.54; + resolution.x=(unsigned long) (100.0*2.54*resolution.x+0.5)/100.0; + resolution.y=(unsigned long) (100.0*2.54*resolution.y+0.5)/100.0; } SetGeometry(image,&geometry); (void) FormatMagickString(page_geometry,MaxTextExtent,"%lux%lu", diff --git a/coders/ps2.c b/coders/ps2.c index 76c78bd68..1b152d754 100644 --- a/coders/ps2.c +++ b/coders/ps2.c @@ -511,8 +511,8 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image) } if (image->units == PixelsPerCentimeterResolution) { - resolution.x*=2.54; - resolution.y*=2.54; + resolution.x=(unsigned long) (100.0*2.54*resolution.x+0.5)/100.0; + resolution.y=(unsigned long) (100.0*2.54*resolution.y+0.5)/100.0; } SetGeometry(image,&geometry); (void) FormatMagickString(page_geometry,MaxTextExtent,"%lux%lu", diff --git a/coders/ps3.c b/coders/ps3.c index 4a2d4784f..3207a21a7 100644 --- a/coders/ps3.c +++ b/coders/ps3.c @@ -932,8 +932,8 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image) } if (image->units == PixelsPerCentimeterResolution) { - resolution.x*=2.54; - resolution.y*=2.54; + resolution.x=(unsigned long) (100.0*2.54*resolution.x+0.5)/100.0; + resolution.y=(unsigned long) (100.0*2.54*resolution.y+0.5)/100.0; } SetGeometry(image,&geometry); (void) FormatMagickString(page_geometry,MaxTextExtent,"%lux%lu", diff --git a/magick/image.c b/magick/image.c index 9bfcd4802..e80932c78 100644 --- a/magick/image.c +++ b/magick/image.c @@ -4094,8 +4094,10 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info, { if (units == PixelsPerInchResolution) { - image->x_resolution*=2.54; - image->y_resolution*=2.54; + image->x_resolution=(unsigned long) (100.0*2.54* + image->x_resolution+0.5)/100.0; + image->y_resolution=(unsigned long) (100.0*2.54* + image->y_resolution+0.5)/100.0; } break; }