sigil-image
Memory-based raster image decoding and PNG encoding for Sigil
Report a bug or suggest a featuregit clone https://git.usesigil.org/sigil/sigil-image.git
sigil-image
Memory-based PNG and JPEG decoding with PNG output for Sigil servers and tools. The (sigil image) module uses STB without desktop graphics, windowing, GPU or filesystem dependencies. Existing (sigil graphics image) APIs are unchanged.
Use
(import (sigil core)
(sigil image))
(define result
(image-normalize-png input-bytes
max-dimension: 2048
max-pixels: 4194304
max-input-bytes: 2097152))
(when result
(dict-ref result bytes:) ; RGBA PNG bytevector
(dict-ref result width:)
(dict-ref result height:))Invalid, unsupported or oversized images return #f. Invalid argument types or limits raise an error. Successful normalization decodes the pixels and writes a new PNG, dropping source metadata. Claimed filenames and MIME types are not used. The default limits are shown above. Maximum configurable limits are 8192 pixels per side, 16,777,216 pixels and 16,777,216 input bytes. Decoding is synchronous and buffered; callers must also bound transport bodies, concurrency and request rates.
Only PNG and JPEG input is supported. EXIF orientation and animation are not interpreted. The API does not retain color profiles, offer general resizing, or provide file storage, authentication or application upload policy.
Build and verify
sigil deps install
sigil build
sigil test --sgl --strictRequires Sigil 0.21 and its native build toolchain. The tests use tiny synthetic PNG/JPEG fixtures and check conversion, dimensions, metadata removal, malformed input and decoding budgets. No network service or credentials are needed.
BSD-3-Clause for the Sigil wrapper; see LICENSE. Vendored STB retains its upstream MIT/public-domain license notices. See vendor/stb/README.md for provenance.
v0.1.0 — latest by version, released 6 Sep 2026
All releases — 1 tag in this repository.
One page per file, and every line has a permalink.
The last 20 commits keep a page here. Everything older lives in the clone.