File ImageMagick-gamma-issues.patch of Package ImageMagick.12441
Index: ImageMagick-7.0.7-34/MagickCore/enhance.c
===================================================================
--- ImageMagick-7.0.7-34.orig/MagickCore/enhance.c 2018-05-20 17:55:42.000000000 +0200
+++ ImageMagick-7.0.7-34/MagickCore/enhance.c 2018-06-01 10:04:32.673707600 +0200
@@ -1813,7 +1813,6 @@ MagickExport MagickBooleanType GammaImag
/*
Gamma-correct colormap.
*/
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
image->colormap[i].red=(double) gamma_map[ScaleQuantumToMap(
ClampToQuantum(image->colormap[i].red))];
@@ -1826,20 +1825,6 @@ MagickExport MagickBooleanType GammaImag
if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
image->colormap[i].alpha=(double) gamma_map[ScaleQuantumToMap(
ClampToQuantum(image->colormap[i].alpha))];
-#else
- if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
- image->colormap[i].red=QuantumRange*gamma_pow(QuantumScale*
- image->colormap[i].red,1.0/gamma);
- if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
- image->colormap[i].green=QuantumRange*gamma_pow(QuantumScale*
- image->colormap[i].green,1.0/gamma);
- if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
- image->colormap[i].blue=QuantumRange*gamma_pow(QuantumScale*
- image->colormap[i].blue,1.0/gamma);
- if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
- image->colormap[i].alpha=QuantumRange*gamma_pow(QuantumScale*
- image->colormap[i].alpha,1.0/gamma);
-#endif
}
/*
Gamma-correct image.
@@ -1878,11 +1863,7 @@ MagickExport MagickBooleanType GammaImag
PixelTrait traits = GetPixelChannelTraits(image,channel);
if ((traits & UpdatePixelTrait) == 0)
continue;
-#if !defined(MAGICKCORE_HDRI_SUPPORT)
- q[j]=gamma_map[ScaleQuantumToMap(q[j])];
-#else
- q[j]=QuantumRange*gamma_pow(QuantumScale*q[j],1.0/gamma);
-#endif
+ q[j]=gamma_map[ScaleQuantumToMap(ClampToQuantum(q[j]))];
}
q+=GetPixelChannels(image);
}