From: Cristy Date: Fri, 3 Feb 2017 00:45:11 +0000 (-0500) Subject: ... X-Git-Tag: 7.0.4-7~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a89424462686d131902240c58ad82d80b0ae7e13;p=imagemagick ... --- diff --git a/MagickCore/channel.c b/MagickCore/channel.c index fd2c980fc..0ddcbfc05 100644 --- a/MagickCore/channel.c +++ b/MagickCore/channel.c @@ -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: diff --git a/MagickCore/pixel.c b/MagickCore/pixel.c index dc101d9cc..858dc99eb 100644 --- a/MagickCore/pixel.c +++ b/MagickCore/pixel.c @@ -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);