]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 11 Mar 2012 23:33:15 +0000 (23:33 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 11 Mar 2012 23:33:15 +0000 (23:33 +0000)
MagickCore/channel.c
MagickCore/token.c

index 28ae9b27c04c08fd44399d5594ebc705d781b8ca..b0f13a685a1fca66cc22cd81c723f48836de24f9 100644 (file)
@@ -232,6 +232,8 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
   destination_image=CloneImage(source_image,0,0,MagickTrue,exception);
   if (destination_image == (Image *) NULL)
     return((Image *) NULL);
+  if (destination_image->colorspace == GRAYColorspace)
+    destination_image->colorspace=RGBColorspace;
   if (expression == (const char *) NULL)
     return(destination_image);
   destination_channel=RedPixelChannel;
@@ -268,8 +270,8 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
         status=SetImageStorageClass(destination_image,DirectClass,exception);
         if (status == MagickFalse)
           {
-            destination_image=GetLastImageInList(destination_image);
-            return((Image *) NULL);
+            destination_image=DestroyImageList(destination_image);
+            return(destination_image);
           }
         if ((channel_op == ExtractChannelOp) && (channels == 1))
           {
@@ -279,9 +281,11 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
         canvas=CloneImage(source_image,0,0,MagickTrue,exception);
         if (canvas == (Image *) NULL)
           {
-            destination_image=GetLastImageInList(destination_image);
-            return((Image *) NULL);
+            destination_image=DestroyImageList(destination_image);
+            return(destination_image);
           }
+        if (canvas->colorspace == GRAYColorspace)
+          canvas->colorspace=RGBColorspace;
         AppendImageToList(&destination_image,canvas);
         destination_image=GetLastImageInList(destination_image);
         GetMagickToken(p,&p,token);
@@ -294,7 +298,7 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
         (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
           "UnrecognizedChannelType","`%s'",token);
         destination_image=DestroyImageList(destination_image);
-        break;
+        return(destination_image);
       }
     source_channel=(PixelChannel) i;
     channel_op=ExtractChannelOp;
@@ -333,7 +337,7 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
             (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
               "UnrecognizedChannelType","`%s'",token);
             destination_image=DestroyImageList(destination_image);
-            break;
+            return(destination_image);
           }
         destination_channel=(PixelChannel) i;
         GetMagickToken(p,&p,token);
index e84c5dc69278a84cc548fc7152fdfd3176467ca0..c32ec63685b2c0b22d9b722ab2209bef70a2b1a3 100644 (file)
@@ -249,7 +249,8 @@ MagickExport void GetMagickToken(const char *start,const char **end,char *token)
         for ( ; *p != '\0'; p++)
         {
           if (((isspace((int) ((unsigned char) *p)) != 0) || (*p == '=') ||
-              (*p == ',') || (*p == ':') || (*p == ';')) && (*(p-1) != '\\'))
+              (*p == ':') || (*p == ',') || (*p == '|') || (*p == ';')) &&
+              (*(p-1) != '\\'))
             break;
           if ((i > 0) && (*p == '<'))
             break;