diff --git a/prs/png_wrap.cpp b/prs/png_wrap.cpp index e2afcc1a8..5f5e80b79 100644 --- a/prs/png_wrap.cpp +++ b/prs/png_wrap.cpp @@ -102,8 +102,11 @@ void PNGWrapper::Read(PRSVideoFrame *frame) { color_type = png_get_color_type(png_ptr, info_ptr); if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr); if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr); + else if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(png_ptr); if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr); if (bit_depth > 8) png_set_strip_16(png_ptr); + if (bit_depth < 8) png_set_packing(png_ptr); + if (color_type == PNG_COLOR_TYPE_RGB) png_set_filler(png_ptr, 0xFFFF, PNG_FILLER_AFTER); png_read_update_info(png_ptr, info_ptr); int rowLen = png_get_rowbytes(png_ptr,info_ptr);