Skip to content

Commit

Permalink
#3337 stop libwebp from guessing if there's an alpha channel
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Nov 9, 2021
1 parent aa1d0ff commit 168a75f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xpra/codecs/webp/encoder.pyx
Expand Up @@ -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
Expand Down

0 comments on commit 168a75f

Please sign in to comment.