]> granicus.if.org Git - imagemagick/commitdiff
Return a gamma of 1.0 when transforming linear RGB to gray
authorCristy <urban-warrior@imagemagick.org>
Tue, 12 Dec 2017 15:16:09 +0000 (10:16 -0500)
committerCristy <urban-warrior@imagemagick.org>
Tue, 12 Dec 2017 15:16:09 +0000 (10:16 -0500)
MagickCore/colorspace.c

index 5a1002f176c29216ad09faf4cb5ac895b13b3c91..3b17edaab79cf93f303aeca6c2cf5019e44b2616 100644 (file)
@@ -51,6 +51,7 @@
 #include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
+#include "MagickCore/enhance.h"
 #include "MagickCore/image.h"
 #include "MagickCore/image-private.h"
 #include "MagickCore/gem.h"
@@ -1281,12 +1282,8 @@ MagickExport MagickBooleanType TransformImageColorspace(Image *image,
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   if (image->colorspace == colorspace)
     return(SetImageColorspace(image,colorspace,exception));
-  if ((image->colorspace == GRAYColorspace) && (image->gamma != 1.0) &&
-      (colorspace == sRGBColorspace))
-    return(SetImageColorspace(image,colorspace,exception));
-  if ((image->colorspace == RGBColorspace) && (image->gamma != 1.0) &&
-      (colorspace == RGBColorspace))
-    return(SetImageColorspace(image,colorspace,exception));
+  if ((image->colorspace == RGBColorspace) && (colorspace == GRAYColorspace))
+    return(GrayscaleImage(image,Rec709LuminancePixelIntensityMethod,exception));
   if (colorspace == UndefinedColorspace)
     return(SetImageColorspace(image,colorspace,exception));
   /*