From 74b1d5d41f68ff170031101a689bc9ca162c60b9 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 13 Aug 2016 19:29:18 -0400 Subject: [PATCH] ://github.com/ImageMagick/ImageMagick/issues/250 --- ChangeLog | 2 ++ MagickCore/channel.c | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b06786d9..1586ae26c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2016-08-07 7.0.2-8 Cristy * Prevent spurious removal of MPC cache files (reference https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=30256). + * Note alpha channel when combining 4 or more images (reference + https://github.com/ImageMagick/ImageMagick/issues/250). 2016-08-06 7.0.2-7 Cristy * Release ImageMagick version 7.0.2-7, GIT revision 10980:ecc03a2:20160806. diff --git a/MagickCore/channel.c b/MagickCore/channel.c index 1c64db9b3..38282e8d7 100644 --- a/MagickCore/channel.c +++ b/MagickCore/channel.c @@ -507,8 +507,30 @@ MagickExport Image *CombineImages(const Image *image, (void) SetImageColorspace(combine_image,sRGBColorspace,exception); else (void) SetImageColorspace(combine_image,colorspace,exception); - if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) - combine_image->alpha_trait=BlendPixelTrait; + switch (combine_image->colorspace) + { + case UndefinedColorspace: + case sRGBColorspace: + { + if (GetImageListLength(image) > 3) + combine_image->alpha_trait=BlendPixelTrait; + break; + } + case GRAYColorspace: + { + if (GetImageListLength(image) > 1) + combine_image->alpha_trait=BlendPixelTrait; + break; + } + case CMYKColorspace: + { + if (GetImageListLength(image) > 4) + combine_image->alpha_trait=BlendPixelTrait; + break; + } + default: + break; + } /* Combine images. */ -- 2.49.0