From 68a0f3f8b8e90190c78bc65403fc81192fb3da59 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 24 Apr 2021 08:43:01 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/3571 --- magick/colorspace.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/magick/colorspace.c b/magick/colorspace.c index 104bc1560a..60db280c77 100644 --- a/magick/colorspace.c +++ b/magick/colorspace.c @@ -422,9 +422,10 @@ MagickExport MagickBooleanType RGBTransformImage(Image *image, MagickRealType gray; - gray=0.212656*GetPixelRed(q)+0.715158*GetPixelGreen(q)+ - 0.072186*GetPixelBlue(q); - SetPixelGray(q,ClampToQuantum(DecodePixelGamma(gray))); + gray=0.212656*DecodePixelGamma(GetPixelRed(q))+0.715158* + DecodePixelGamma(GetPixelGreen(q))+0.072186* + DecodePixelGamma(GetPixelBlue(q)); + SetPixelGray(q,ClampToQuantum(gray)); q++; } sync=SyncCacheViewAuthenticPixels(image_view,exception); @@ -2080,9 +2081,9 @@ MagickExport MagickBooleanType TransformRGBImage(Image *image, MagickRealType gray; - gray=0.212656*GetPixelRed(q)+0.715158*GetPixelGreen(q)+ - 0.072186*GetPixelBlue(q); - gray=EncodePixelGamma(gray); + gray=0.212656*EncodePixelGamma(GetPixelRed(q))+0.715158* + EncodePixelGamma(GetPixelGreen(q))+0.072186* + EncodePixelGamma(GetPixelBlue(q)); SetPixelRed(q,ClampToQuantum(gray)); SetPixelGreen(q,ClampToQuantum(gray)); SetPixelBlue(q,ClampToQuantum(gray));