]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Fri, 3 Feb 2017 00:45:11 +0000 (19:45 -0500)
committerCristy <urban-warrior@imagemagick.org>
Fri, 3 Feb 2017 00:45:37 +0000 (19:45 -0500)
MagickCore/channel.c
MagickCore/pixel.c

index fd2c980fceb2b473c2cef42c6f8bf5feec508435..0ddcbfc058158cce2ed53d859d446d7f4853fe82 100644 (file)
@@ -239,6 +239,15 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
     return((Image *) NULL);
   if (expression == (const char *) NULL)
     return(destination_image);
+  if (image->colorspace == UndefinedColorspace)
+    {
+      status=SetImageStorageClass(destination_image,DirectClass,exception);
+      if (status == MagickFalse)
+        {
+          destination_image=DestroyImageList(destination_image);
+          return(destination_image);
+        }
+    }
   destination_channel=RedPixelChannel;
   channel_mask=UndefinedChannel;
   pixel=0.0;
@@ -348,6 +357,10 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
               }
           }
         destination_channel=(PixelChannel) i;
+        if (image->colorspace == UndefinedColorspace)
+          (void) SetPixelMetaChannels(destination_image,(size_t) (
+            destination_channel-GetPixelChannels(destination_image)+1),
+            exception);
         switch (destination_channel)
         {
           case RedPixelChannel:
index dc101d9cce93b72c43ead8ddb87ac4b2e979f050..858dc99eb1cce274e44fddad5c6bfdef289d9b85 100644 (file)
@@ -4453,13 +4453,13 @@ MagickExport void InitializePixelChannelMap(Image *image)
   if (image->write_mask != MagickFalse)
     SetPixelChannelAttributes(image,WriteMaskPixelChannel,CopyPixelTrait,n++);
   assert((n+image->number_meta_channels) < MaxPixelChannels);
+  image->number_channels=(size_t) n;
   trait=CopyPixelTrait;
   if (image->colorspace == UndefinedColorspace)
     trait=UpdatePixelTrait;
   for (i=0; i < (ssize_t) image->number_meta_channels; i++)
     SetPixelChannelAttributes(image,(PixelChannel) (MetaPixelChannel+i),trait,
       n++);
-  image->number_channels=(size_t) n;
   if (image->debug != MagickFalse)
     LogPixelChannels(image);
   SetImageChannelMask(image,image->channel_mask);