spngsave: fix 8bpp palette save with transparency (#2808)

This commit is contained in:
Kleis Auke Wolthuizen 2022-05-26 18:26:26 +02:00 committed by GitHub
parent 7121f952d5
commit 550781cd18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -395,8 +395,6 @@ vips_foreign_save_spng_write( VipsForeignSaveSpng *spng, VipsImage *in )
for( i = 0; i < palette_count; i++ ) { for( i = 0; i < palette_count; i++ ) {
VipsPel *p = (VipsPel *) VipsPel *p = (VipsPel *)
VIPS_IMAGE_ADDR( im_palette, i, 0 ); VIPS_IMAGE_ADDR( im_palette, i, 0 );
if( p[3] == 255 ) {
struct spng_plte_entry *entry = struct spng_plte_entry *entry =
&plte.entries[plte.n_entries]; &plte.entries[plte.n_entries];
@ -404,8 +402,8 @@ vips_foreign_save_spng_write( VipsForeignSaveSpng *spng, VipsImage *in )
entry->green = p[1]; entry->green = p[1];
entry->blue = p[2]; entry->blue = p[2];
plte.n_entries += 1; plte.n_entries += 1;
}
else { if( p[3] != 255 ) {
trns.type3_alpha[trns.n_type3_entries] = p[3]; trns.type3_alpha[trns.n_type3_entries] = p[3];
trns.n_type3_entries += 1; trns.n_type3_entries += 1;
} }