forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 04c2ffd1efc4b56af8bfff799d2f93e28b73c4e6Filtered to scripts/lib/gen-bmp-shapes.pyClear filter

2026-08-26

feat(image): decode BMP, including the shapes ImageMagick will not writeAhmet Kaan Gümüş · f1f296e
feat(image): decode BMP, including the shapes ImageMagick will not write

gpui names ImageFormat::Bmp, so the shim needed a decoder behind it. This
reads every shape the format defines: 1/2/4/8/16/24/32-bit samples, palettes
with three- or four-byte entries, BI_RLE4 and BI_RLE8, arbitrary BI_BITFIELDS
masks, bottom-up and top-down rows, and headers of every defined length from
the 12-byte OS/2 v1 to the 124-byte BITMAPV5HEADER.

Two shapes that started as refusals are decoded instead. BI_PNG and BI_JPEG
files are a BMP header wrapped around a whole file of another format, so they
are handed to this crate's own PNG and JPEG decoders. The 16-byte OS/2 v2
header is the Windows layout truncated where the two stop agreeing, so it is
read through those 16 bytes -- which is what ffmpeg does, and what the
incumbent image crate refuses.

Gate: fourteen fixtures pixel-exact against image 0.25.10, the two wrapper
files exact against the incumbent decoding their payloads directly, and the
OS/2 v2 file exact against the same picture in a header the incumbent reads.
Twenty thousand fuzz mutations across the plain and run-length paths, no
panics. Full report in lanes/image-bmp-r1.report.md.