From 9f0fa85ee29d661f91aab1275659f6690551069b Mon Sep 17 00:00:00 2001 From: glennrp Date: Thu, 15 Dec 2011 12:20:50 +0000 Subject: [PATCH] Fixed bug with scaling background while writing sub-8-bit grayscale images. --- coders/png.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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(), -- 2.40.0