From 146c48281b69f6084ef8c44ac08fb5edb8aa564a Mon Sep 17 00:00:00 2001 From: Cristy Date: Mon, 23 Nov 2015 21:13:27 -0500 Subject: [PATCH] If image does not have an alpha channel, set the total error to opaque --- MagickCore/quantize.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/MagickCore/quantize.c b/MagickCore/quantize.c index a7a99cd43..8da62f8cf 100644 --- a/MagickCore/quantize.c +++ b/MagickCore/quantize.c @@ -890,8 +890,11 @@ static MagickBooleanType ClassifyImageColors(CubeInfo *cube_info, node_info->total_color.green+=count*QuantumScale*ClampPixel(pixel.green); node_info->total_color.blue+=count*QuantumScale*ClampPixel(pixel.blue); if (cube_info->associate_alpha != MagickFalse) - node_info->total_color.alpha+=count*QuantumScale*ClampPixel( - pixel.alpha); + node_info->total_color.alpha+=count*QuantumScale* + ClampPixel(pixel.alpha); + else + node_info->total_color.alpha+=count*QuantumScale* + ClampPixel(OpaqueAlpha); p+=count*GetPixelChannels(image); } if (cube_info->colors > cube_info->maximum_colors) @@ -994,8 +997,11 @@ static MagickBooleanType ClassifyImageColors(CubeInfo *cube_info, node_info->total_color.green+=count*QuantumScale*ClampPixel(pixel.green); node_info->total_color.blue+=count*QuantumScale*ClampPixel(pixel.blue); if (cube_info->associate_alpha != MagickFalse) - node_info->total_color.alpha+=count*QuantumScale*ClampPixel( - pixel.alpha); + node_info->total_color.alpha+=count*QuantumScale* + ClampPixel(pixel.alpha); + else + node_info->total_color.alpha+=count*QuantumScale* + ClampPixel(OpaqueAlpha); p+=count*GetPixelChannels(image); } proceed=SetImageProgress(image,ClassifyImageTag,(MagickOffsetType) y, -- 2.50.0