GNU bug report logs -
#59242
29.0.50; Poor quality for WebP images
Previous Next
Reported by: Evgeny Zajcev <lg.zevlg <at> gmail.com>
Date: Sun, 13 Nov 2022 08:49:01 UTC
Severity: normal
Tags: patch
Found in version 29.0.50
Fixed in version 30.1
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Evgeny Zajcev <lg.zevlg <at> gmail.com> writes:
> WebP images with alpha channel renders in poor quality in the Emacs.
> See http://lgarc.narod.ru/pics/emacs-webp-poor-quality.png
>
> If I convert webp image to png, quality is ok in resulting image.
> Also, if I add webp as native image under MacOS (requires Emacs patch)
> then quality is also ok.
>
> Looks like partial transparency is incorrectly applied for webp images.
Stefan, I see the following code in image.c:
/* An alpha channel associates variable transparency with an
image. WebP allows up to 256 levels of partial transparency.
We handle this like with PNG (which see), using the frame's
background color to combine the image with. */
if (features.has_alpha || anim)
{
if (mask_img)
PUT_PIXEL (mask_img, x, y, *p > 0 ? PIX_MASK_DRAW : PIX_MASK_RETAIN);
however, you seem to have misunderstood the meaning of the PNG code: PNG
images can either have a real alpha channel (where the PNG library does
the blending AFAIK) or a simple on-off transparency switch, which is the
only case where this kind of masking is appropriate.
As a questionable optimization, Emacs also uses masking when only alpha
channels of 0 or 255 are present in a PNG image that has a real alpha
channel.
So if the webp library does not blend itself, I think we will have to do
that for it. Am I missing anything here?
This bug report was last modified 1 year and 362 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.