AtlatestRepositorysigil-image
1# sigil-image
2
3Memory-based PNG and JPEG decoding with PNG output for Sigil servers and tools.
4The `(sigil image)` module uses STB without desktop graphics, windowing, GPU or
5filesystem dependencies. Existing `(sigil graphics image)` APIs are unchanged.
6
7## Use
8
9```scheme
10(import (sigil core)
11 (sigil image))
13(define result
14 (image-normalize-png input-bytes
15 max-dimension: 2048
16 max-pixels: 4194304
17 max-input-bytes: 2097152))
19(when result
20 (dict-ref result bytes:) ; RGBA PNG bytevector
21 (dict-ref result width:)
22 (dict-ref result height:))
23```
25Invalid, unsupported or oversized images return `#f`. Invalid argument types or
26limits raise an error. Successful normalization decodes the pixels and writes a
27new PNG, dropping source metadata. Claimed filenames and MIME types are not used.
28The default limits are shown above. Maximum configurable limits are 8192 pixels
29per side, 16,777,216 pixels and 16,777,216 input bytes. Decoding is synchronous and
30buffered; callers must also bound transport bodies, concurrency and request rates.
32Only PNG and JPEG input is supported. EXIF orientation and animation are not
33interpreted. The API does not retain color profiles, offer general resizing, or
34provide file storage, authentication or application upload policy.
36## Build and verify
38```sh
39sigil deps install
40sigil build
41sigil test --sgl --strict
42```
44Requires Sigil 0.21 and its native build toolchain. The tests use tiny synthetic
45PNG/JPEG fixtures and check conversion, dimensions, metadata removal, malformed
46input and decoding budgets. No network service or credentials are needed.
48BSD-3-Clause for the Sigil wrapper; see LICENSE. Vendored STB retains its upstream
49MIT/public-domain license notices. See vendor/stb/README.md for provenance.