-
Notifications
You must be signed in to change notification settings - Fork 683
Open
Description
In our integration with Chromium we have executed the test suites for BMP and compared current results from Chromium BMP decoder with the BMP decoder from image crate. We are creating this issue for tracking the gaps and reference it in following PRs that will try to close the gap whenever it makes sense.
After analyzing differences, we have spot these discrepancies:
OS/2 v2 palette format not supported - The decoder doesn't recognize OS/2 BITMAPINFOHEADER2 format (64-byte header with variable palette entry sizes of 3 or 4 bytes). Chromium supports this legacy format. Affected tests:PR Adds support for decoding BMP files using the OS/2 2v2 and OS/2-specific 24-bit RLE compression. #2770pal8os2v2.bmp, pal8os2v2-16.bmp, pal8os2v2-sz.bmp- RLE transparency handling - When RLE-encoded images have "delta" escapes or truncated data leaving unfilled pixels, Chromium treats these as transparent (alpha=0), while the Rust decoder leaves them as opaque black. Affected tests:
pal4rlecut.bmp, pal4rletrns.bmp, pal8rletrns.bmp - Oversize palette validation - Chromium accepts BMPs where biClrUsed exceeds the maximum for the bit depth (e.g., 300 colors for 8-bit) by clamping to the valid range. The Rust decoder rejects these files entirely. Affected test:
pal8oversizepal.bmp Stricter Header validation - Chromium tolerates invalid header values like biPlanes != 1 or biClrUsed > 256 and proceeds with decoding. The Rust decoder returns an error. Affected tests:PR Allow lenient validation in BMP decoder #2764badplanes.bmp, badpalettesize.bmpTruncated RGB16 data handling - For truncated 16-bit RGB files, Chromium decodes available rows and fills remaining pixels. The Rust decoder fails at metadata parsing. Affected test:PR Allow lenient validation in BMP decoder #2764rgb16-880.bmpRLE top-down validation — Chromium accepts top-down RLE images (negative height) as valid, while the Rust decoder rejects them during header validation. Affected test:PR Allow lenient validation in BMP decoder #2764rletopdown.bmpBI_ALPHABITFIELDS alpha mask not read - For BITMAPINFOHEADER with compression type BI_ALPHABITFIELDS (6), the alpha bitmask wasn't being read, causing transparent pixels to render as opaque. Affected test:PR Implement support for alphabitfields in BMP #2762rgba32abf.bmp
Reference Chromium CL: https://chromium-review.googlesource.com/c/chromium/src/+/7465861
BMP files can be found in: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/images/bmp-suite/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels