[File] [PATCH] fix WebP VP8L alpha detection
Lucy Phipps
landfillbaby69 at gmail.com
Thu Aug 21 02:14:28 UTC 2025
the spec basically says it reads the bytes of a VP8L chunk in big endian
order, but the bits of each byte in reverse.
so the 29th bit would be 4th byte & (1 << (7 - (32 - 29))) == 0x10.
idk where the previous value 3rd byte & 0x01 came from.
getting the image dimensions from this format is difficult because of this.
per-byte bit reversal of a big-endian uint32_t (or per-word bit reversal of
little-endian), then decode it into 2 packed 14-bit integers at the high
end, then add 1... but at least a single bit is easy enough.
---
magic/Magdir/riff | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/magic/Magdir/riff b/magic/Magdir/riff
index d5b6e738a..92d7a49b4 100644
--- a/magic/Magdir/riff
+++ b/magic/Magdir/riff
@@ -161,7 +161,7 @@
>>>>>15 byte&0x40 =0x00 \b, decoders should clamp
>0 string VP8L
>>8 byte 0x2f \b, lossless
->>>11 byte &0x01 \b, with alpha
+>>>12 byte &0x10 \b, with alpha
>0 string VP8X
>>4 lelong 0x0a
>>>8 byte &0x02 \b, animated
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.astron.com/pipermail/file/attachments/20250821/09c71ca7/attachment.htm>
More information about the File
mailing list