From: Cristy Date: Tue, 14 Nov 2017 12:57:24 +0000 (-0500) Subject: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=33070 X-Git-Tag: 7.0.7-12~87 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a2d7a71ee37dca68f32bd2ed4e9c7299a6d78a77;p=imagemagick http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=33070 --- diff --git a/ChangeLog b/ChangeLog index 1532aa3b1..aea5d490a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-11-12 7.0.7-12 Cristy + * The -tint option no longer munges the alpha channel (reference + http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=33070). + 2017-11-11 7.0.7-11 Cristy * Release ImageMagick version 7.0.7-11, GIT revision 21635:0447c6b46:20171111. diff --git a/MagickCore/fx.c b/MagickCore/fx.c index c2264b469..6560cb54a 100644 --- a/MagickCore/fx.c +++ b/MagickCore/fx.c @@ -5423,25 +5423,14 @@ MagickExport Image *TintImage(const Image *image,const char *blend, double weight; - register ssize_t - i; - - for (i=0; i < (ssize_t) GetPixelChannels(image); i++) - { - PixelChannel channel = GetPixelChannelChannel(image,i); - PixelTrait traits = GetPixelChannelTraits(image,channel); - PixelTrait tint_traits=GetPixelChannelTraits(tint_image,channel); - if ((traits == UndefinedPixelTrait) || - (tint_traits == UndefinedPixelTrait)) - continue; - if (((tint_traits & CopyPixelTrait) != 0) || - (GetPixelWriteMask(image,p) <= (QuantumRange/2))) - { - SetPixelChannel(tint_image,channel,p[i],q); - continue; - } - } GetPixelInfo(image,&pixel); + if (GetPixelWriteMask(image,p) <= (QuantumRange/2)) + { + SetPixelViaPixelInfo(tint_image,&pixel,q); + p+=GetPixelChannels(image); + q+=GetPixelChannels(tint_image); + continue; + } weight=QuantumScale*GetPixelRed(image,p)-0.5; pixel.red=(double) GetPixelRed(image,p)+color_vector.red*(1.0-(4.0* (weight*weight))); @@ -5454,6 +5443,7 @@ MagickExport Image *TintImage(const Image *image,const char *blend, weight=QuantumScale*GetPixelBlack(image,p)-0.5; pixel.black=(double) GetPixelBlack(image,p)+color_vector.black*(1.0-(4.0* (weight*weight))); + pixel.alpha=GetPixelAlpha(image,p); SetPixelViaPixelInfo(tint_image,&pixel,q); p+=GetPixelChannels(image); q+=GetPixelChannels(tint_image);