From: Thomas Debesse Date: Sat, 30 Mar 2024 00:19:15 +0000 (+0100) Subject: netradiant: strip 16-bit png to 8-bit, fix #153 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2Fillwieckz%2Fpng16;p=xonotic%2Fnetradiant.git netradiant: strip 16-bit png to 8-bit, fix #153 --- 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 ); }