You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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 PR Add alpha channel to BMP with RLE to allow setting transparency to skipped pixels #2773
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 PR Allow lenient validation in BMP decoder #2764
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: badplanes.bmp, badpalettesize.bmp PR Allow lenient validation in BMP decoder #2764
Truncated 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: rgb16-880.bmp PR Allow lenient validation in BMP decoder #2764
RLE top-down validation — Chromium accepts top-down RLE images (negative height) as valid, while the Rust decoder rejects them during header validation. Affected test: rletopdown.bmp PR Allow lenient validation in BMP decoder #2764
BI_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: rgba32abf.bmp PR Implement support for alphabitfields in BMP #2762
V4 color space parameters are not exposed causing different pixel colors resulting in Chromium w.r.t. BmpDecoder. Affected test: pal8v4.bmp PR Support BMP V4/V5 color space fields #2771
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.bmpRLE 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:PR Add alpha channel to BMP with RLE to allow setting transparency to skipped pixels #2773pal4rlecut.bmp, pal4rletrns.bmp, pal8rletrns.bmpOversize 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:PR Allow lenient validation in BMP decoder #2764pal8oversizepal.bmpStricter 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.bmpV4 color space parameters are not exposed causing different pixel colors resulting in Chromium w.r.t. BmpDecoder. Affected test:PR Support BMP V4/V5 color space fields #2771pal8v4.bmpReference 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/