Issue 605 in webp: RGB channels from RGBA WebP files are seemingly broken

134 views
Skip to first unread message

jz… via monorail

unread,
Mar 13, 2023, 4:59:16 PM3/13/23
to webp-d...@webmproject.org
Status: Accepted
Owner: jz...@google.com
CC: gta.p...@gmail.com
Labels: Type-Defect Priority-Medium

New issue 605 by jz...@google.com: RGB channels from RGBA WebP files are seemingly broken
https://bugs.chromium.org/p/webp/issues/detail?id=605

Originally:
https://groups.google.com/a/webmproject.org/g/webp-discuss/c/T8vSUNvEVZs/m/8m_PQuApBQAJ?utm_medium=email&utm_source=footer

This issue is with libwebp-1.3.0. I've taken note that 32-bit RGBA WebP files will create corrupted RGB channels when loaded through the SDK. I had seen that in my own custom importer and thought that it was something I was doing incorrectly. The alpha channel itself may be correct.

However, I was able to replicate it easily with the dwebp.exe test app:

dwebp.exe 1_webp_a.webp -bmp -o 1_webp_a.bmp

The 1_webp_a.webp file is attached to this posting and can also be downloaded from the link on this page:

https://developers.google.com/speed/webp/gallery2

Attachments:
1_webp_a.bmp 470 KB
1_webp_a.webp 17.7 KB

--
You received this message because:
1. The project was configured to send all issue notifications to this address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

jz… via monorail

unread,
Mar 13, 2023, 5:05:07 PM3/13/23
to webp-d...@webmproject.org

Comment #1 on issue 605 by jz...@google.com: RGB channels from RGBA WebP files are seemingly broken
https://bugs.chromium.org/p/webp/issues/detail?id=605#c1

How was 1_webp_a.bmp created? If I use the binaries from the 1.3.0 release (both wic and non-wic) I can only reproduce that rendering in Photos App or Paint. Opening them in Chrome applies the alpha channel correctly.

The output from the release binaries match the output on Linux, but the md5 for the attached bitmap doesn't match and shows the RGB values burned in with an opaque alpha. I don't think this is an issue with the decoder, but there may be limitations in the Windows applications for applying the alpha or it may have something to do with how webp is writing them.

jz… via monorail

unread,
Mar 13, 2023, 5:59:18 PM3/13/23
to webp-d...@webmproject.org

Comment #2 on issue 605 by jz...@google.com: RGB channels from RGBA WebP files are seemingly broken
https://bugs.chromium.org/p/webp/issues/detail?id=605#c2

For reference, the attached bitmap was made using the libwebp release binaries. Comparing this file and the one attached in the initial report, it looks like the first one is missing alpha information from BITMAPV3INFOHEADER [1][2]. The Photos and Paint applications may not support this. I haven't looked to see if there is another way to convey this information.

[1] https://chromium.googlesource.com/webm/libwebp/+/refs/tags/v1.3.0/imageio/image_enc.c#296
[2] https://en.wikipedia.org/wiki/BMP_file_format#DIB_header_(bitmap_information_header)

Attachments:
1_webp_a-libwebp-1.3.0-release-binaries.bmp 470 KB

GTA Photo Items

unread,
Mar 13, 2023, 6:41:05 PM3/13/23
to WebP Discussion, jz… via monorail, no_r...@monorail-prod.appspotmail.com
Thanks for checking into it. I can confirm that this issue exists in the current Windows release.


dwebp.exe 1_webp_a.webp -bmp -o 1_webp_a.bmp

dwebp.exe
471,040

The same visual issues in the RGB channels can also be seen in my own custom importer and not just in the dwebp output into BMP format.

jz… via monorail

unread,
Mar 13, 2023, 9:24:10 PM3/13/23
to webp-d...@webmproject.org

Comment #3 on issue 605 by jz...@google.com: RGB channels from RGBA WebP files are seemingly broken
https://bugs.chromium.org/p/webp/issues/detail?id=605#c3

Note email replies may not work correctly when replying to the group.


From:
https://groups.google.com/a/webmproject.org/g/webp-discuss/c/1-Z7QG38LQY/m/yczkOBFNAQAJ

Thanks for checking into it. I can confirm that this issue exists in the current Windows release.

I used ' libwebp-1.3.0-windows-x64.zip'.

dwebp.exe 1_webp_a.webp -bmp -o 1_webp_a.bmp

dwebp.exe
471,040

The same visual issues in the RGB channels can also be seen in my own custom importer and not just in the dwebp output into BMP format.

jz… via monorail

unread,
Mar 13, 2023, 9:32:38 PM3/13/23
to webp-d...@webmproject.org

Comment #4 on issue 605 by jz...@google.com: RGB channels from RGBA WebP files are seemingly broken
https://bugs.chromium.org/p/webp/issues/detail?id=605#c4


> I used ' libwebp-1.3.0-windows-x64.zip'.
>
> dwebp.exe 1_webp_a.webp -bmp -o 1_webp_a.bmp

That binary should have produced the same image as the one I attached to
comment #2. It appears to be lacking the RGBA mask information; did you happen
to open it in an editor and save it?


> The same visual issues in the RGB channels can also be seen in my own custom
> importer and not just in the dwebp output into BMP format.

The issue comes from how applications are interpreting the alpha channel.
libwebp may modify pixels in areas with fully transparent alpha to improve
compression. What you're seeing is what the image looks like with an opaque
alpha channel, rather than a transparent one.

To remove the question of the bmp file, you can try -ppm and -pam, using
something like ImageMagick's display application to view the images. The ppm
file will look like the bmp file you originally uploaded. The pam file will
hide the pixels, much like the png output will. The same goes for the bmp I
uploaded when rendered in Chrome.

GTA Photo Items

unread,
Mar 14, 2023, 3:40:36 PM3/14/23
to WebP Discussion, jz… via monorail, no_r...@monorail-prod.appspotmail.com
>The issue comes from how applications are interpreting the alpha channel.
>libwebp may modify pixels in areas with fully transparent alpha to improve
>compression. What you're seeing is what the image looks like with an opaque
>alpha channel, rather than a transparent one.

Please excuse my short delay in responding as otherwise I was planning to pen this response last night.

In retrospect I now understand that this all comes down to my own perspective on what I was seeing and what viewing methods I was using to display the converted files. Indeed your explanation is bang on and makes complete sense. I went back, with this new perspective, and confirmed that the alpha channels were correct on the various files + when using my WebP importer API. As you say, some of the RGB channels had become messed up during some prior conversion process but the alpha channel was correct.

Thanks again for your swift response and for providing this proper perspective on what I was seeing.

jz… via monorail

unread,
Mar 14, 2023, 10:12:09 PM3/14/23
to webp-d...@webmproject.org


Please excuse my short delay in responding as otherwise I was planning to pen this response last night.

In retrospect I now understand that this all comes down to my own perspective on what I was seeing and what viewing methods I was using to display the converted files. Indeed your explanation is bang on and makes complete sense. I went back, with this new perspective, and confirmed that the alpha channels were correct on the various files + when using my WebP importer API. As you say, some of the RGB channels had become messed up during some prior conversion process but the alpha channel was correct.

Thanks again for your swift response and for providing this proper perspective on what I was seeing.

jz… via monorail

unread,
Mar 14, 2023, 10:13:44 PM3/14/23
to webp-d...@webmproject.org
Updates:
Status: Invalid

Comment #6 on issue 605 by jz...@google.com: RGB channels from RGBA WebP files are seemingly broken
https://bugs.chromium.org/p/webp/issues/detail?id=605#c6

Thanks for the update. I'm glad that things are a little clearer. It's good to know that some Windows applications don't apply the alpha channel when rendering. I'm not sure if there's a good forum for reporting bugs / features requests on those.
Reply all
Reply to author
Forward
0 new messages