Issue 533 in webp: cwebp doesn't support alpha - from command line

14 views
Skip to first unread message

kiloo… via monorail

unread,
Jul 14, 2021, 9:48:00 PMJul 14
to webp-d...@webmproject.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 533 by kiloo...@gmail.com: cwebp doesn't support alpha - from command line
https://bugs.chromium.org/p/webp/issues/detail?id=533

What steps will reproduce the problem?
1. Download "3 hits.webp" from attached files.
2. Attempt to convert/compress it:
cwebp -q 70 "3 hits.webp" -o "newImage.webp"

What is the expected output? What do you see instead?
Expected a faded red outline, instead I get a solid red image as seen from attached files.

What version of the product are you using? On what operating system?
libwebp-1.2.0-windows-x64

Please provide any additional information below.
This image was originally converted to webp from png using the PIL module in python3. Feel free to contact me if specifics on that is required.

Attachments:
3 hits.webp 35.9 KB
newImage.webp 3.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

kiloo… via monorail

unread,
Jul 14, 2021, 9:49:30 PMJul 14
to webp-d...@webmproject.org

Comment #1 on issue 533 by kiloo...@gmail.com: cwebp doesn't support alpha - from command line
https://bugs.chromium.org/p/webp/issues/detail?id=533#c1

Python 3, PIL webp conversion:
```
img = Image.open(os.path.join(*imagePath))
img = img.convert("RGBA")
imageName = os.path.splitext(imagePath[1])[0]

img.save(f"{imageName}.webp", "webp", quality=self.getQuality)
os.remove(imagePath[1])
```

ygu… via monorail

unread,
Jul 15, 2021, 5:55:11 AMJul 15
to webp-d...@webmproject.org

Comment #2 on issue 533 by ygu...@google.com: cwebp doesn't support alpha - from command line
https://bugs.chromium.org/p/webp/issues/detail?id=533#c2

I tried the following on Windows:
libwebp-1.2.0-windows-x64\bin\cwebp.exe -q 70 "3 hits.webp" -o "newImage.webp"
and the equivalent on Linux, they both produce the attached image, which has alpha as expected.
Could you check that the command line you gave was the one you used, and also the input/output images?
Did you build or download the binaries?

Attachments:
newImage.webp 11.6 KB

kiloo… via monorail

unread,
Jul 15, 2021, 11:48:51 AMJul 15
to webp-d...@webmproject.org

Comment #3 on issue 533 by kiloo...@gmail.com: cwebp doesn't support alpha - from command line
https://bugs.chromium.org/p/webp/issues/detail?id=533#c3

That is very weird, I downloaded the binaries.

Attached below a short clip of the process, hope this helps figure out whats going on.

Attachments:
2021-07-15 16-46-03.mkv 3.0 MB

ygu… via monorail

unread,
Jul 15, 2021, 12:23:34 PMJul 15
to webp-d...@webmproject.org

Comment #4 on issue 533 by ygu...@google.com: cwebp doesn't support alpha - from command line
https://bugs.chromium.org/p/webp/issues/detail?id=533#c4

Thank you for the video. This is strange indeed.

For comparison this is the beginning of the output of my ./cwebp -q 70 "3 hits.webp" -o "newImage.webp":
Saving file 'newImage.webp'
File: 3 hits.webp
Dimension: 1920 x 1080 (with alpha)
...

We can see that "with alpha" is missing in the log of your video. It seems the decoding is erroneous here, rather than the encoding.

For reference:
./webpinfo "3 hits.webp"
File: 3 hits.webp
RIFF HEADER:
File size: 36810
Chunk VP8X at offset 12, length 18
ICCP: 0
Alpha: 1
...
md5sum "3 hits.webp"
57363e25d6896442ab03b4f085367afb 3 hits.webp

Could you run webpinfo and md5 too, to compare the results?
Could you also try opening your source image with other tools, such as GIMP, Photoshop+WebPShop, and/or ImageMagick?

kiloo… via monorail

unread,
Jul 15, 2021, 5:20:27 PMJul 15
to webp-d...@webmproject.org

Comment #5 on issue 533 by kiloo...@gmail.com: cwebp doesn't support alpha - from command line
https://bugs.chromium.org/p/webp/issues/detail?id=533#c5


Could you run webpinfo and md5 too, to compare the results?
D:\Oscar Six\Desktop>libwebp-1.2.0-windows-x64\bin\webpinfo.exe "3 hits.webp"

File: 3 hits.webp
RIFF HEADER:
File size: 36810
Chunk VP8X at offset 12, length 18
ICCP: 0
Alpha: 1
EXIF: 0
XMP: 0
Animation: 0
Canvas size 1920 x 1080
Chunk ALPH at offset 30, length 13908
Chunk VP8 at offset 13938, length 22872
Width: 1920
Height: 1080
Alpha: 0
Animation: 0
Format: Lossy (1)
No error detected.

MD5: 57363e25d6896442ab03b4f085367afb


D:\Oscar Six\Desktop>libwebp-1.2.0-windows-x64\bin\webpinfo.exe "newImage.webp"
File: newImage.webp
RIFF HEADER:
File size: 3800
Chunk VP8 at offset 12, length 3788
Width: 1920
Height: 1080
Alpha: 0
Animation: 0
Format: Lossy (1)
No error detected.

MD5: 1212d3dadc30af7d4461416ee11a6401

Openning the "3 hits.webp" file in GIMP gives the following result (see attached image)

Attachments:
Screenshot 2021-07-15 222016.png 165 KB

ygu… via monorail

unread,
Jul 16, 2021, 5:29:21 AMJul 16
to webp-d...@webmproject.org

Comment #6 on issue 533 by ygu...@google.com: cwebp doesn't support alpha - from command line
https://bugs.chromium.org/p/webp/issues/detail?id=533#c6

I noticed my cwebp was also outputting the following:
IWICImagingFactory_CreateDecoderFromStream( factory, stream, NULL, WICDecodeMetadataCacheOnDemand, &decoder) failed 88982f50
which is missing from your logs. It probably means that your cwebp uses Windows Imaging Component to decode the image, contrary to mine, but somehow it does not handle the alpha part. Reasons I could think of are an older libwebp version being used, a custom WIC decoder and a bug in imageio/wicdec.c.

Could you try a non-WIC binary, such as the following?
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.2.0-rc3-windows-x64-no-wic.zip

Could you also provide your operating system's version, for future reference?

kiloo… via monorail

unread,
Jul 16, 2021, 5:56:40 AMJul 16
to webp-d...@webmproject.org

Comment #7 on issue 533 by kiloo...@gmail.com: cwebp doesn't support alpha - from command line
https://bugs.chromium.org/p/webp/issues/detail?id=533#c7


Could you try a non-WIC binary, such as the following?
This worked. Gave the correct, expected image. Thank you for the help.


Could you also provide your operating system's version, for future reference?
Using the latest version of Windows 10.
Edition: Windows 10 Pro
Version: 21H1
Installed Date: 09/04/2021 (DD/MM/YYYY)
OS Build: 19043.1110

jz… via monorail

unread,
Jul 16, 2021, 2:48:36 PMJul 16
to webp-d...@webmproject.org
Updates:
Blocking: 521

Comment #10 on issue 533 by jz...@google.com: cwebp doesn't support alpha - from command line
https://bugs.chromium.org/p/webp/issues/detail?id=533#c10

(No comment was entered for this change.)

Git Watcher via monorail

unread,
Jul 16, 2021, 8:03:04 PMJul 16
to webp-d...@webmproject.org

Comment #11 on issue 533 by Git Watcher: cwebp doesn't support alpha - from command line
https://bugs.chromium.org/p/webp/issues/detail?id=533#c11

The following revision refers to this bug:
https://chromium.googlesource.com/webm/libwebp/+/a89a3230c91f5a33f11f60f7e11d020de0af327d

commit a89a3230c91f5a33f11f60f7e11d020de0af327d
Author: James Zern <jz...@google.com>
Date: Fri Jul 16 19:16:54 2021

wicdec: support alpha from WebP WIC decoder

the container check may not be strictly necessary now that the alpha
check has matured and the library will detect usable alpha, but it's
safer to fix this case first before making larger changes.

Bug: webp:533
Change-Id: I2e1ba42156970d579a52bd183707a037e65fd900

[modify] https://crrev.com/a89a3230c91f5a33f11f60f7e11d020de0af327d/imageio/wicdec.c

jz… via monorail

unread,
Jul 20, 2021, 7:50:45 PMJul 20
to webp-d...@webmproject.org
Updates:
Status: Fixed

Comment #12 on issue 533 by jz...@chromium.org: cwebp doesn't support alpha - from command line
https://bugs.chromium.org/p/webp/issues/detail?id=533#c12


(No comment was entered for this change.)

Reply all
Reply to author
Forward
0 new messages