]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
netradiant: strip 16-bit png to 8-bit, fix #153 illwieckz/png16
authorThomas Debesse <dev@illwieckz.net>
Sat, 30 Mar 2024 00:19:15 +0000 (01:19 +0100)
committerThomas Debesse <dev@illwieckz.net>
Sat, 30 Mar 2024 00:19:15 +0000 (01:19 +0100)
plugins/imagepng/plugin.cpp

index 449bbf1bca9d689fa810bf09c63f114b1baecc7a..b6cde5813a60a8adfb047a815da4414a028f2176 100644 (file)
@@ -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 );
        }