]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Fri, 15 Feb 2013 00:35:19 +0000 (00:35 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Fri, 15 Feb 2013 00:35:19 +0000 (00:35 +0000)
MagickCore/enhance.c
MagickCore/fx.c

index b3d66dbe0b9a49708fa0bf0f5e8618b1cc3cc4d2..112c7b11b16444fc8162686260c4449e46389820 100644 (file)
@@ -757,8 +757,8 @@ MagickExport MagickBooleanType ColorDecisionListImage(Image *image,
       }
     for (x=0; x < (ssize_t) image->columns; x++)
     {
-      luma=0.21267f*GetPixelRed(image,q)+0.71526*GetPixelGreen(image,q)+0.07217f*
-        GetPixelBlue(image,q);
+      luma=0.21267f*GetPixelRed(image,q)+0.71526*GetPixelGreen(image,q)+
+        0.07217f*GetPixelBlue(image,q);
       SetPixelRed(image,ClampToQuantum(luma+color_correction.saturation*
         (cdl_map[ScaleQuantumToMap(GetPixelRed(image,q))].red-luma)),q);
       SetPixelGreen(image,ClampToQuantum(luma+color_correction.saturation*
@@ -998,6 +998,9 @@ MagickExport MagickBooleanType ContrastStretchImage(Image *image,
   CacheView
     *image_view;
 
+  ColorspaceType
+    colorspace;
+
   MagickBooleanType
     status;
 
@@ -1049,6 +1052,9 @@ MagickExport MagickBooleanType ContrastStretchImage(Image *image,
   /*
     Form histogram.
   */
+  colorspace=image->colorspace;
+  if (colorspace == sRGBColorspace)
+    (void) SetImageColorspace(image,RGBColorspace,exception);
   status=MagickTrue;
   (void) ResetMagickMemory(histogram,0,(MaxMap+1)*GetPixelChannels(image)*
     sizeof(*histogram));
@@ -1138,13 +1144,11 @@ MagickExport MagickBooleanType ContrastStretchImage(Image *image,
         stretch_map[GetPixelChannels(image)*j+i]=0.0;
       else
         if (j > (ssize_t) white[i])
-          stretch_map[GetPixelChannels(image)*j+i]=(double)
-            QuantumRange;
+          stretch_map[GetPixelChannels(image)*j+i]=(double) QuantumRange;
         else
           if (black[i] != white[i])
-            stretch_map[GetPixelChannels(image)*j+i]=(double)
-              ScaleMapToQuantum((double) (MaxMap*(j-black[i])/
-              (white[i]-black[i])));
+            stretch_map[GetPixelChannels(image)*j+i]=(double) ScaleMapToQuantum(
+              (double) (MaxMap*(j-black[i])/(white[i]-black[i])));
     }
   }
   if (image->storage_class == PseudoClass)
@@ -1250,6 +1254,8 @@ MagickExport MagickBooleanType ContrastStretchImage(Image *image,
           status=MagickFalse;
       }
   }
+  if (colorspace == sRGBColorspace)
+    (void) SetImageColorspace(image,sRGBColorspace,exception);
   image_view=DestroyCacheView(image_view);
   stretch_map=(double *) RelinquishMagickMemory(stretch_map);
   white=(double *) RelinquishMagickMemory(white);
index 93e462b94e453d9ad1aaf18a573c513e04aea2c7..74f636dc24331c162ba043387e733b1a824ce156 100644 (file)
@@ -783,9 +783,9 @@ MagickExport Image *ColorizeImage(const Image *image,const char *blend,
             SetPixelChannel(colorize_image,channel,p[i],q);
             continue;
           }
-        SetPixelChannel(colorize_image,channel,
-          ClampToQuantum(Colorize(p[i],GetPixelInfoChannel(&blend_percentage,
-          channel),GetPixelInfoChannel(colorize,channel))),q);
+        SetPixelChannel(colorize_image,channel,ClampToQuantum(Colorize(p[i],
+          GetPixelInfoChannel(&blend_percentage,channel),GetPixelInfoChannel(
+          colorize,channel))),q);
       }
       p+=GetPixelChannels(image);
       q+=GetPixelChannels(colorize_image);