From ba04c5f03fd7517ee4000611af9fd7b492e38396 Mon Sep 17 00:00:00 2001 From: Sergey Alexandrovich Date: Thu, 26 May 2022 22:23:04 +0600 Subject: [PATCH] cgifsave: fill transparent pixels with zeroes (#2823) --- libvips/foreign/cgifsave.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libvips/foreign/cgifsave.c b/libvips/foreign/cgifsave.c index 098cbd32..c7d657e8 100644 --- a/libvips/foreign/cgifsave.c +++ b/libvips/foreign/cgifsave.c @@ -237,7 +237,8 @@ vips_foreign_save_cgif_write_frame( VipsForeignSaveCgif *cgif ) */ p = frame_bytes; for( i = 0; i < n_pels; i++ ) { - p[3] = p[3] >= 128 ? 255 : 0; + if (p[3] >= 128) p[3] = 255; + else memset(p, 0, 4); p += 4; }