vectorcraft/crates/render
bflatastic ac77b52ad3 M4.49: PNG-8 and GIF export with a palette quantizer and dithering
document.export {format: "png8" | "gif"} reduces the art to a palette of at most `colors`
(2–256) entries: median cut over a 15-bit histogram refined by k-means (perceptual,
selective or adaptive weighting), or the web-safe, black-and-white or grey palettes; art
with that many colours or fewer keeps them exactly. Dithering is Floyd–Steinberg diffusion,
an 8×8 ordered pattern or noise, with an amount. Pixels under half opacity become one
transparent entry; partly transparent edges blend over the matte. PNG-8 is an indexed PNG
(PLTE, tRNS, 1–8 bits per pixel, Adam7); GIF is a GIF89a (optionally interlaced). Both are in
document.formats, Export As (PNG-8 / GIF Options dialogs) and Export for Screens.
document.formats' writable list and the MCP export tool's format enum gain gif and png8
(their tests list them).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 11:26:15 +07:00
..
examples Robustness: VectorCraft never crashes — no panics in shipped code 2026-10-05 06:28:59 +07:00
src M4.49: PNG-8 and GIF export with a palette quantizer and dithering 2026-10-05 11:26:15 +07:00
tests M14.4: tests main gained follow the no-panic lint rules 2026-10-05 06:40:34 +07:00
Cargo.toml M4.49: PNG-8 and GIF export with a palette quantizer and dithering 2026-10-05 11:26:15 +07:00