From: dirk Date: Sat, 3 Sep 2016 19:08:33 +0000 (+0200) Subject: CopyCompositeOp should set the alpha channel to opaque if the source image has no... X-Git-Tag: 7.0.3-0~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65d195e5b3cdbf4a62270f403597af41a5d4b1b3;p=imagemagick CopyCompositeOp should set the alpha channel to opaque if the source image has no alpha channel. --- diff --git a/MagickCore/composite.c b/MagickCore/composite.c index 8e70a7f95..f9945b2c9 100644 --- a/MagickCore/composite.c +++ b/MagickCore/composite.c @@ -641,16 +641,18 @@ MagickExport MagickBooleanType CompositeImage(Image *image, q+=GetPixelChannels(image); continue; } - for (i=0; i < (ssize_t) GetPixelChannels(source_image); i++) + for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { - PixelChannel channel=GetPixelChannelChannel(source_image,i); + PixelChannel channel=GetPixelChannelChannel(image,i); + PixelTrait traits=GetPixelChannelTraits(image,channel); PixelTrait source_traits=GetPixelChannelTraits(source_image, channel); - PixelTrait traits=GetPixelChannelTraits(image,channel); - if ((traits == UndefinedPixelTrait) || - (source_traits == UndefinedPixelTrait)) + if (traits == UndefinedPixelTrait) continue; - SetPixelChannel(image,channel,p[i],q); + if (source_traits != UndefinedPixelTrait) + SetPixelChannel(image,channel,p[i],q); + else if (channel == AlphaPixelChannel) + SetPixelChannel(image,channel,OpaqueAlpha,q); } p+=GetPixelChannels(source_image); q+=GetPixelChannels(image);