]> granicus.if.org Git - imagemagick/commitdiff
Enable alpha channel if background color is non-opaque
authorCristy <urban-warrior@imagemagick.org>
Fri, 9 Dec 2016 15:40:04 +0000 (10:40 -0500)
committerCristy <urban-warrior@imagemagick.org>
Fri, 9 Dec 2016 15:40:04 +0000 (10:40 -0500)
ChangeLog
MagickCore/image.c

index b51477ebe4100044ca35172a8b38c4acdec09d12..f75b906620eada3f7d056d3bda6bf5631f3486e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
     https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=29105).
   * Respect connected-components:area-threshold define (reference
     https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31006). 
+  * Enable alpha channel if background color is non-opaque (reference
+    https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=31016).
 
 2016-12-05  7.0.3-9 Cristy  <quetzlzacatenango@image...>
   * Release ImageMagick version 7.0.3-9, GIT revision 19139:6fed3f1:20161205.
index 685d3acea7e30a07d3b02e89661b99396ee60215..ae1f3a20eb6928e63177e67fdb827a490c400010 100644 (file)
@@ -49,6 +49,7 @@
 #include "MagickCore/cache.h"
 #include "MagickCore/cache-private.h"
 #include "MagickCore/cache-view.h"
+#include "MagickCore/channel.h"
 #include "MagickCore/client.h"
 #include "MagickCore/color.h"
 #include "MagickCore/color-private.h"
@@ -2240,6 +2241,9 @@ MagickExport MagickBooleanType SetImageBackgroundColor(Image *image,
   assert(image->signature == MagickCoreSignature);
   if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
     return(MagickFalse);
+  if ((image->background_color.alpha != OpaqueAlpha) &&
+      (image->alpha_trait == UndefinedPixelTrait))
+    (void) SetImageAlphaChannel(image,OnAlphaChannel,exception);
   ConformPixelInfo(image,&image->background_color,&background,exception);
   /*
     Set image background color.