Hi Webp Discuss,I had a question about how webp decoders should handles lossless webp. Sorry if this is answered somewhere in the documentation!It looks like lossless webp is encoded as BGRA (which indicates that it always has an alpha channel). However, it also seems that the has_alpha feature is still set (or not set) by a flag in the header. Does this mean that lossless webps are allowed to not have alpha?
In this case, should we ignore the alpha channel and treat the image as opaque? Or should we always respect the alpha channel?
--Thanks!Matt
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.
To post to this group, send email to webp-d...@webmproject.org.
Visit this group at https://groups.google.com/a/webmproject.org/group/webp-discuss/.
For more options, visit https://groups.google.com/a/webmproject.org/d/optout.
--
Ping. Any thoughts?
Hi,I'm reviving this thread as we look to add animated webp to Skia's decoder (CL is here https://skia-review.googlesource.com/c/16707/). It seems that Chromium's WEBPImageDecoder does respect the alpha reported by libwebp, although I find it a little inconsistent. Sometimes it uses WebPIterator.has_alpha, and sometimes it checks whether ALPHA_FLAG is set in WebPDemuxGetI(demux_, WEBP_FF_FORMAT_FLAGS). The latter seems to report whether *any* frame has alpha. (The documentation does not specify that it is a hint, but I'm guessing that it is?)
AFAICT Chromium truly wants to know whether a particular frame has alpha in each case. Why doesn't Chromium always use WebPIterator.has_alpha? (Or neither, if they're only hints?)
urvang@, it looks like this code dates back to the introduction of animated webp support in https://chromiumcodereview.appspot.com/13980003. Do you remember why you used one or the other?(FWIW, I found a webp file checked into Chromium, which I've attached, whose WEBP_FF_FORMAT_FLAGS report that there is alpha, while all the individual frames' WebPIterators report that they are opaque. It seems the two values are encoded into the stream, so either one could be more trustworthy than the other.)