From c626e7d5441b223738b475d2df887e886587f67b Mon Sep 17 00:00:00 2001 From: James Zern Date: Mon, 8 Aug 2022 16:42:00 -0700 Subject: [PATCH] cwebp: fix WebPPictureHasTransparency call when near_lossless is < 100; previously the zeroed 'picture' would be passed in the check rather than the original picture. this would result in alpha never been kept in the decode. Change-Id: I6af3aef7de2d672e044025d975d8180b12d5fa40 --- examples/cwebp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/cwebp.c b/examples/cwebp.c index a9f93be0..a06b233a 100644 --- a/examples/cwebp.c +++ b/examples/cwebp.c @@ -1140,9 +1140,10 @@ int main(int argc, const char* argv[]) { } picture.use_argb = 1; - if (!ReadWebP(memory_writer.mem, memory_writer.size, &picture, - /*keep_alpha=*/WebPPictureHasTransparency(&picture), - /*metadata=*/NULL)) { + if (!ReadWebP( + memory_writer.mem, memory_writer.size, &picture, + /*keep_alpha=*/WebPPictureHasTransparency(&original_picture), + /*metadata=*/NULL)) { fprintf(stderr, "Error! Cannot decode encoded WebP bitstream\n"); fprintf(stderr, "Error code: %d (%s)\n", picture.error_code, kErrorMessages[picture.error_code]);