% MagickCore Image Colorspace Methods %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 1992 %
% %
% %
-% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
green,
red;
- red=(double) GetPixelRed(image,q);
- green=(double) GetPixelGreen(image,q);
- blue=(double) GetPixelBlue(image,q);
+ red=(double) DecodePixelGamma((MagickRealType)
+ GetPixelRed(image,q));
+ green=(double) DecodePixelGamma((MagickRealType)
+ GetPixelGreen(image,q));
+ blue=(double) DecodePixelGamma((MagickRealType)
+ GetPixelBlue(image,q));
SetPixelRed(image,logmap[ScaleQuantumToMap(ClampToQuantum(red))],q);
SetPixelGreen(image,logmap[ScaleQuantumToMap(ClampToQuantum(green))],
q);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
+ if (image->colorspace == colorspace)
+ return(MagickTrue);
+ if ((image->colorspace == GRAYColorspace) && (image->gamma != 1.0) &&
+ (colorspace == sRGBColorspace))
+ return(MagickTrue);
if (colorspace == UndefinedColorspace)
return(SetImageColorspace(image,colorspace,exception));
/*
red=(double) logmap[ScaleQuantumToMap(GetPixelRed(image,q))];
green=(double) logmap[ScaleQuantumToMap(GetPixelGreen(image,q))];
blue=(double) logmap[ScaleQuantumToMap(GetPixelBlue(image,q))];
- SetPixelRed(image,ClampToQuantum(red),q);
- SetPixelGreen(image,ClampToQuantum(green),q);
- SetPixelBlue(image,ClampToQuantum(blue),q);
+ SetPixelRed(image,ClampToQuantum(EncodePixelGamma((MagickRealType)
+ red)),q);
+ SetPixelGreen(image,ClampToQuantum(EncodePixelGamma((MagickRealType)
+ green)),q);
+ SetPixelBlue(image,ClampToQuantum(EncodePixelGamma((MagickRealType)
+ blue)),q);
q+=GetPixelChannels(image);
}
sync=SyncCacheViewAuthenticPixels(image_view,exception);