From: Cristy Date: Sat, 20 Jul 2019 13:24:36 +0000 (-0400) Subject: https://imagemagick.org/discourse-server/viewtopic.php?f=3&t=36396 X-Git-Tag: 7.0.8-56~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c69c477e65d2a2695278ca614ffb9a3385137bc;p=imagemagick https://imagemagick.org/discourse-server/viewtopic.php?f=3&t=36396 --- diff --git a/ChangeLog b/ChangeLog index 0a3d8f928..2eb363e30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-07-20 7.0.8-56 Cristy + * Release ImageMagick version 7.0.8-56, GIT revision 15... + +2019-07-20 7.0.8-56 Cristy + * Unexpected -alpha shape results (reference + https://imagemagick.org/discourse-server/viewtopic.php?f=3&t=36396). + 2019-07-18 7.0.8-55 Cristy * Release ImageMagick version 7.0.8-55, GIT revision 15930:ac09240:20190718. diff --git a/MagickCore/channel.c b/MagickCore/channel.c index 9737388f5..043d14257 100644 --- a/MagickCore/channel.c +++ b/MagickCore/channel.c @@ -1259,17 +1259,50 @@ MagickExport MagickBooleanType SetImageAlphaChannel(Image *image, } case ShapeAlphaChannel: { + PixelInfo + background; + /* - Set alpha channel by shape. + Remove transparency. */ + ConformPixelInfo(image,&image->background_color,&background,exception); + background.alpha_trait=BlendPixelTrait; + image->alpha_trait=BlendPixelTrait; status=SetImageStorageClass(image,DirectClass,exception); if (status == MagickFalse) break; - image->alpha_trait=UpdatePixelTrait; - (void) SetImageMask(image,WritePixelMask,image,exception); - (void) LevelImageColors(image,&image->background_color, - &image->background_color,MagickTrue,exception); - (void) SetImageMask(image,WritePixelMask,(Image *) NULL,exception); + image_view=AcquireAuthenticCacheView(image,exception); +#if defined(MAGICKCORE_OPENMP_SUPPORT) + #pragma omp parallel for schedule(static) shared(status) \ + magick_number_threads(image,image,image->rows,1) +#endif + for (y=0; y < (ssize_t) image->rows; y++) + { + register Quantum + *magick_restrict q; + + register ssize_t + x; + + if (status == MagickFalse) + continue; + q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1, + exception); + if (q == (Quantum *) NULL) + { + status=MagickFalse; + continue; + } + for (x=0; x < (ssize_t) image->columns; x++) + { + background.alpha=GetPixelIntensity(image,q); + SetPixelViaPixelInfo(image,&background,q); + q+=GetPixelChannels(image); + } + if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) + status=MagickFalse; + } + image_view=DestroyCacheView(image_view); break; } case TransparentAlphaChannel: