From 7a730843f94a9d7c221825fe7998bf2b06abf80c Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Sat, 30 Mar 2024 01:19:15 +0100 Subject: [PATCH] netradiant: strip 16-bit png to 8-bit, fix #153 --- plugins/imagepng/plugin.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/imagepng/plugin.cpp b/plugins/imagepng/plugin.cpp index 449bbf1b..b6cde581 100644 --- a/plugins/imagepng/plugin.cpp +++ b/plugins/imagepng/plugin.cpp @@ -109,6 +109,11 @@ Image* LoadPNGBuff( unsigned char* fbuffer ){ png_set_expand_gray_1_2_4_to_8( png_ptr ); } + // Strip 16-bit to 8-bit + if ( bit_depth == 16 ) { + png_set_strip_16( png_ptr ); + } + if ( png_get_valid( png_ptr, info_ptr, PNG_INFO_tRNS ) ) { png_set_tRNS_to_alpha( png_ptr ); } -- 2.39.2