Fix T45283: Blender crashes on some grayscale PNGs with alpha.
PNG_COLOR_TYPE_GRAY colortype can have some values for alpha, in the same way as PNG_COLOR_TYPE_PALETTE colortype. In this case, we need two channels (grayscale and alpha), not one.
This commit is contained in:
@@ -584,6 +584,10 @@ ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags, char colorspace[I
|
||||
if (bit_depth < 8) {
|
||||
png_set_expand(png_ptr);
|
||||
bit_depth = 8;
|
||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
|
||||
/* PNG_COLOR_TYPE_GRAY may also have alpha 'values', like with palette. */
|
||||
bytesperpixel = 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user