From: glennrp Date: Thu, 15 Dec 2011 12:20:50 +0000 (+0000) Subject: Fixed bug with scaling background while writing sub-8-bit grayscale images. X-Git-Tag: 7.0.1-0~6535 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f0fa85ee29d661f91aab1275659f6690551069b;p=imagemagick Fixed bug with scaling background while writing sub-8-bit grayscale images. --- diff --git a/coders/png.c b/coders/png.c index f908090a6..2d8abe9fd 100644 --- a/coders/png.c +++ b/coders/png.c @@ -9664,9 +9664,9 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, if (ping_exclude_bKGD == MagickFalse) { - ping_background.gray=(png_uint_16) - ((maxval/255.)*((GetPixelInfoIntensity(&image->background_color))) - +.5); + ping_background.gray=(png_uint_16) ((maxval/65535.)* + (ScaleQuantumToShort(((GetPixelInfoIntensity( + &image->background_color))) +.5))); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),