spngsave: fix transparency (#3074)

This commit is contained in:
Sergey Alexandrovich 2022-10-15 01:05:29 +06:00 committed by GitHub
parent f38acdef1a
commit c6498e5c2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -472,14 +472,9 @@ vips_foreign_save_spng_write( VipsForeignSaveSpng *spng, VipsImage *in )
entry->blue = p[2];
plte.n_entries += 1;
/* Quantizr and libimagequant sort the pallette
* by transparency, so trns.type3_alpha[] and
* plte.entries[] will use the same indexing.
*/
g_assert( i == 0 || p[3] >= p[-1] );
trns.type3_alpha[i] = p[3];
if( p[3] != 255 ) {
trns.type3_alpha[trns.n_type3_entries] = p[3];
trns.n_type3_entries += 1;
trns.n_type3_entries = i+1;
}
}