Skip to content

v0.2.0 — full BMP/DIB, SVG and ICO support

Choose a tag to compare

@pengtang1024 pengtang1024 released this 18 Nov 04:31
· 28 commits to develop since this release

Added

  • Full BMP/DIB coverage in decodeBmp(): 1/4/8/16/24/32-bit pixels, BI_RLE8/BI_RLE4, BI_BITFIELDS/BI_ALPHABITFIELDS, BITMAPCOREHEADER, BITMAPV2/V3/V4/V5HEADER, OS/2 v2 headers and headerless DIBs (the CF_DIB shape).
  • Embedded JPEG/PNG payloads (BI_JPEG/BI_PNG) are unwrapped and handed to the browser decoder.
  • SVG pastes are rasterised through an <img> element; viewBox provides the size when width/height are missing.
  • ICO/CUR fall back to the largest PNG-compressed directory entry when the browser cannot decode the icon.
  • Magic-byte detection for AVIF, HEIC/HEIF, ICO/CUR, SVG and headerless DIBs.
  • MIME alias table so image/jpg, image/x-png, image/x-bmp, image/x-xpixmap, image/svg+xml and friends are treated as the canonical type.
  • MAX_PIXELS guard (64 Mi px) before a BMP/XPM canvas is allocated.
  • docs/formats.md: the decision pipeline, the full format matrix, the BMP variant grid and the checklist for adding a format.
  • docs/releasing.md: version policy, release checklist, npm publish steps and marketplace sync.
  • Open-source scaffolding: .github/CODEOWNERS, issue-template contact links, README badges, and a Community section linking contributing, conduct, security, changelog and releases.

Changed

  • A native image with an empty declared type is re-wrapped with the sniffed type instead of being passed through and rejected by the host.
  • Row stride, palette entries, bit masks and alpha handling in the BMP decoder are shared by every pixel depth instead of being hard-coded for 24/32-bit.
  • BMP files using BI_CMYK compression (11/12/13) are rejected with bmp: unsupported compression instead of being decoded as RGB.

Fixed

  • 32-bit BMPs whose encoder leaves the alpha channel at zero no longer export as a fully transparent PNG.
  • Palette BMP entries are loaded with the correct entry size (3 bytes for the OS/2 core header, 4 otherwise), and a zero alpha byte in a palette entry no longer makes that colour transparent.
  • cordis.patch.yml is now part of the published files list. GitHub (and future npm) installs used to omit the loader patch, so the bundle entry never mounted; CI checks the tarball for the file.