AtlatestRepositorysigil-image
sigil-image / treeREADME.md
1
# sigil-image3
Memory-based PNG and JPEG decoding with PNG output for Sigil servers and tools.4
The `(sigil image)` module uses STB without desktop graphics, windowing, GPU or5
filesystem dependencies. Existing `(sigil graphics image)` APIs are unchanged.7
## Use9
```scheme10
(import (sigil core)11
(sigil image))13
(define result14
(image-normalize-png input-bytes15
max-dimension: 204816
max-pixels: 419430417
max-input-bytes: 2097152))19
(when result20
(dict-ref result bytes:) ; RGBA PNG bytevector21
(dict-ref result width:)22
(dict-ref result height:))23
```25
Invalid, unsupported or oversized images return `#f`. Invalid argument types or26
limits raise an error. Successful normalization decodes the pixels and writes a27
new PNG, dropping source metadata. Claimed filenames and MIME types are not used.28
The default limits are shown above. Maximum configurable limits are 8192 pixels29
per side, 16,777,216 pixels and 16,777,216 input bytes. Decoding is synchronous and30
buffered; callers must also bound transport bodies, concurrency and request rates.32
Only PNG and JPEG input is supported. EXIF orientation and animation are not33
interpreted. The API does not retain color profiles, offer general resizing, or34
provide file storage, authentication or application upload policy.36
## Build and verify38
```sh39
sigil deps install40
sigil build41
sigil test --sgl --strict42
```44
Requires Sigil 0.21 and its native build toolchain. The tests use tiny synthetic45
PNG/JPEG fixtures and check conversion, dimensions, metadata removal, malformed46
input and decoding budgets. No network service or credentials are needed.48
BSD-3-Clause for the Sigil wrapper; see LICENSE. Vendored STB retains its upstream49
MIT/public-domain license notices. See vendor/stb/README.md for provenance.