]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Fri, 30 Nov 2018 12:32:22 +0000 (07:32 -0500)
committerCristy <urban-warrior@imagemagick.org>
Fri, 30 Nov 2018 12:32:22 +0000 (07:32 -0500)
MagickCore/enhance.c

index 45f3333827d0f1da7598b56107fac85565208e75..67b66c364d847255f175b6d21ea3c3e86d07c733 100644 (file)
@@ -659,7 +659,8 @@ MagickExport MagickBooleanType CLAHEImage(Image *image,const size_t x_tiles,
     ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
       image->filename);
   colorspace=image->colorspace;
-  if (TransformImageColorspace(image,LabColorspace,exception) == MagickFalse)
+  if ((GetPixelChannels(image) >= 3) &&
+      (TransformImageColorspace(image,LabColorspace,exception) == MagickFalse))
     {
       pixel_cache=RelinquishVirtualMemory(pixel_cache);
       return(MagickFalse);
@@ -753,7 +754,8 @@ MagickExport MagickBooleanType CLAHEImage(Image *image,const size_t x_tiles,
   }
   image_view=DestroyCacheView(image_view);
   pixel_cache=RelinquishVirtualMemory(pixel_cache);
-  if (TransformImageColorspace(image,colorspace,exception) == MagickFalse)
+  if ((GetPixelChannels(image) >= 3) &&
+      (TransformImageColorspace(image,colorspace,exception) == MagickFalse))
     status=MagickFalse;
   return(status);
 }