]> granicus.if.org Git - imagemagick/commitdiff
Set linear colorspace when gamma is over 0.75, not when exactly 1.0
authorglennrp <glennrp@git.imagemagick.org>
Sun, 16 Mar 2014 22:08:03 +0000 (22:08 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Sun, 16 Mar 2014 22:08:03 +0000 (22:08 +0000)
coders/png.c

index d6b1d13630407bf7ddf41e610b2ae1a0f1df2992..28e44feac87ebc3467c218f6888cd455a73fc0ca 100644 (file)
@@ -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 &&