From c6498e5c2c83288621017ad185c9356219b1940c Mon Sep 17 00:00:00 2001 From: Sergey Alexandrovich Date: Sat, 15 Oct 2022 01:05:29 +0600 Subject: [PATCH] spngsave: fix transparency (#3074) --- libvips/foreign/spngsave.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/libvips/foreign/spngsave.c b/libvips/foreign/spngsave.c index bbb1494b..1bb2f569 100644 --- a/libvips/foreign/spngsave.c +++ b/libvips/foreign/spngsave.c @@ -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; } }