* The PNG decoder now checks whether the image actually has any transparency
when the input file contains an alpha channel. (Reference
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=17748)
+ * Recently changes sometimes caused the PNG encoder to select colortype=2
+ (Truecolor) instead of 0 (Grayscale) for grayscale images.
2010-12-26 6.6.6-8 Cristy <quetzlzacatenango@image...>
* -posterize fails with more than 40 levels (reference
/* Is there a transparent pixel in the row? */
for (x=(ssize_t) image->columns-1; x >= 0; x--)
{
- if (q->opacity != OpaqueOpacity)
+ if ((ping_color_type == PNG_COLOR_TYPE_RGBA ||
+ ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA) &&
+ (q->opacity != OpaqueOpacity))
{
found_transparent_pixel = MagickTrue;
break;
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Found transparent pixel");
else
- (void) LogMagickEvent(CoderEvent,GetMagickModule(),
- " No transparent pixel was found");
+ {
+ (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+ " No transparent pixel was found");
+ ping_color_type&=0x03;
+ }
}
}
image_matte=MagickTrue;
}
+ if (image_info->type == PaletteType ||
+ image_info->type == PaletteMatteType)
+ ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;
+
if (image_info->type == UndefinedType ||
image_info->type == OptimizeType)
{
-
- if ((image_info->type == GrayscaleType) &&
- image_matte == MagickFalse && ping_have_color != MagickFalse)
+ if (ping_have_color == MagickFalse)
{
- ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY;
- image_matte=MagickFalse;
- }
+ if (image_matte == MagickFalse)
+ {
+ ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY;
+ image_matte=MagickFalse;
+ }
- else if ((image_info->type == GrayscaleMatteType) &&
- image_matte == MagickTrue && ping_have_color != MagickFalse)
- {
- ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY_ALPHA;
- image_matte=MagickTrue;
+ else
+ {
+ ping_color_type=(png_byte) PNG_COLOR_TYPE_GRAY_ALPHA;
+ image_matte=MagickTrue;
+ }
}
+ else
+ {
+ if (image_matte == MagickFalse)
+ {
+ ping_color_type=(png_byte) PNG_COLOR_TYPE_RGB;
+ image_matte=MagickFalse;
+ }
- else if (image_info->type == PaletteType ||
- image_info->type == PaletteMatteType)
- ping_color_type=(png_byte) PNG_COLOR_TYPE_PALETTE;
+ else
+ {
+ ping_color_type=(png_byte) PNG_COLOR_TYPE_RGBA;
+ image_matte=MagickTrue;
+ }
+ }
}
+
}
if (logging != MagickFalse)