From: cristy Date: Tue, 13 Mar 2012 13:01:27 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~6049 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=09ef5be3fd824b0f67f7c0a8a975b52c89689b56;p=imagemagick --- diff --git a/MagickCore/channel.c b/MagickCore/channel.c index b0f13a685..dd236d7bf 100644 --- a/MagickCore/channel.c +++ b/MagickCore/channel.c @@ -241,7 +241,7 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression, p=(char *) expression; GetMagickToken(p,&p,token); channel_op=ExtractChannelOp; - for (channels=0; *p != '\0'; ) + for (channels=0; *token != '\0'; ) { ssize_t i; @@ -267,17 +267,17 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression, Image *canvas; + if ((channel_op == ExtractChannelOp) && (channels == 1)) + { + destination_image->colorspace=GRAYColorspace; + InitializePixelChannelMap(destination_image); + } status=SetImageStorageClass(destination_image,DirectClass,exception); if (status == MagickFalse) { destination_image=DestroyImageList(destination_image); return(destination_image); } - if ((channel_op == ExtractChannelOp) && (channels == 1)) - { - destination_image->colorspace=GRAYColorspace; - InitializePixelChannelMap(destination_image); - } canvas=CloneImage(source_image,0,0,MagickTrue,exception); if (canvas == (Image *) NULL) { @@ -370,18 +370,18 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression, if (status == MagickFalse) break; } + if ((channel_op == ExtractChannelOp) && (channels == 1)) + { + destination_image->colorspace=GRAYColorspace; + InitializePixelChannelMap(destination_image); + } status=SetImageStorageClass(destination_image,DirectClass,exception); if (status == MagickFalse) { destination_image=GetLastImageInList(destination_image); return((Image *) NULL); } - if ((channel_op == ExtractChannelOp) && (channels == 1)) - { - destination_image->colorspace=GRAYColorspace; - InitializePixelChannelMap(destination_image); - } - return(destination_image); + return(GetFirstImageInList(destination_image)); } /*