Skip to content

Commit

Permalink
https://github.com/ImageMagick/ImageMagick/issues/1680
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Sep 14, 2019
1 parent 6686e91 commit f019930
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions magick/colorspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ MagickExport MagickBooleanType RGBTransformImage(Image *image,
MagickRealType
gray;

gray=(MagickRealType) GetPixelIntensity(image,q);
gray=0.212656*GetPixelRed(q)+0.715158*GetPixelGreen(q)+
0.072186*GetPixelBlue(q);
SetPixelGray(q,ClampToQuantum(DecodePixelGamma(gray)));
q++;
}
Expand Down Expand Up @@ -478,7 +479,8 @@ MagickExport MagickBooleanType RGBTransformImage(Image *image,
MagickRealType
gray;

gray=(MagickRealType) GetPixelIntensity(image,q);
gray=0.212656*GetPixelRed(q)+0.715158*GetPixelGreen(q)+
0.072186*GetPixelBlue(q);
SetPixelGray(q,ClampToQuantum(gray));
q++;
}
Expand Down Expand Up @@ -2078,8 +2080,12 @@ MagickExport MagickBooleanType TransformRGBImage(Image *image,
MagickRealType
gray;

gray=(MagickRealType) GetPixelIntensity(image,q);
SetPixelGray(q,ClampToQuantum(gray));
gray=0.212656*GetPixelRed(q)+0.715158*GetPixelGreen(q)+
0.072186*GetPixelBlue(q);
gray=EncodePixelGamma(gray);
SetPixelRed(q,ClampToQuantum(gray));
SetPixelGreen(q,ClampToQuantum(gray));
SetPixelBlue(q,ClampToQuantum(gray));
q++;
}
sync=SyncCacheViewAuthenticPixels(image_view,exception);
Expand Down Expand Up @@ -2136,8 +2142,11 @@ MagickExport MagickBooleanType TransformRGBImage(Image *image,
MagickRealType
gray;

gray=(MagickRealType) GetPixelIntensity(image,q);
SetPixelGray(q,ClampToQuantum(EncodePixelGamma(gray)));
gray=0.212656*GetPixelRed(q)+0.715158*GetPixelGreen(q)+
0.072186*GetPixelBlue(q);
SetPixelRed(q,ClampToQuantum(gray));
SetPixelGreen(q,ClampToQuantum(gray));
SetPixelBlue(q,ClampToQuantum(gray));
q++;
}
sync=SyncCacheViewAuthenticPixels(image_view,exception);
Expand Down

0 comments on commit f019930

Please sign in to comment.