From 168a75ff48edccf3bedd2f58a3e4822858e5dd20 Mon Sep 17 00:00:00 2001 From: totaam Date: Tue, 9 Nov 2021 16:22:51 +0700 Subject: [PATCH] #3337 stop libwebp from guessing if there's an alpha channel --- xpra/codecs/webp/encoder.pyx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xpra/codecs/webp/encoder.pyx b/xpra/codecs/webp/encoder.pyx index 8768b05c94..6486b6f126 100644 --- a/xpra/codecs/webp/encoder.pyx +++ b/xpra/codecs/webp/encoder.pyx @@ -398,7 +398,10 @@ def encode(image, int quality=50, int speed=50, supports_alpha=False, content_ty pixels = image.get_pixels() cdef int threshold_delta = -int(content_type=="text")*20 cdef int alpha_int = int(supports_alpha and pixel_format.find("A")>=0) - cdef int use_argb = int(quality>=(SUBSAMPLING_THRESHOLD+threshold_delta)) + #we can only use YUV420P subsampling if we are 100% certain + #that the RGB pixel data contains a valid alpha component + #because WebPPictureARGBToYUVA will set the alpha channel if it finds ANY value + cdef int use_argb = int(quality>=(SUBSAMPLING_THRESHOLD+threshold_delta)) or pixel_format.find("A")<0 cdef WebPConfig config cdef WebPPreset preset = DEFAULT_PRESET