From: glennrp Date: Sun, 16 Mar 2014 22:08:03 +0000 (+0000) Subject: Set linear colorspace when gamma is over 0.75, not when exactly 1.0 X-Git-Tag: 7.0.1-0~2573 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a5b92ca99910144e70ca19c74d7bfe35eec6fc6;p=imagemagick Set linear colorspace when gamma is over 0.75, not when exactly 1.0 --- diff --git a/coders/png.c b/coders/png.c index d6b1d1363..28e44feac 100644 --- a/coders/png.c +++ b/coders/png.c @@ -3086,19 +3086,25 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, if (((int) ping_color_type == PNG_COLOR_TYPE_GRAY) || ((int) ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA)) { - if ((!png_get_valid(ping,ping_info,PNG_INFO_gAMA) || - image->gamma == 1.0) && ping_found_sRGB != MagickTrue) + double + image_gamma = image->gamma; + + (void)LogMagickEvent(CoderEvent,GetMagickModule(), + " image->gamma=%f",(float) image_gamma); + + if (image_gamma > 0.75) { - /* Set image->gamma to 1.0, image->rendering_intent to Undefined, + /* Set image->rendering_intent to Undefined, * image->colorspace to GRAY, and reset image->chromaticity. */ image->intensity = Rec709LuminancePixelIntensityMethod; SetImageColorspace(image,GRAYColorspace,exception); + image->gamma = image_gamma; } } (void)LogMagickEvent(CoderEvent,GetMagickModule(), - " image->colorspace=%d",(int) image->colorspace); + " image->colorspace=%d",(int) image->colorspace); if (((int) ping_color_type == PNG_COLOR_TYPE_PALETTE) || ((int) ping_bit_depth < 16 &&