25 releases
Uses new Rust 2024
| new 0.6.5 | Mar 8, 2026 |
|---|---|
| 0.6.3 | Mar 2, 2026 |
| 0.5.9 | Feb 28, 2026 |
| 0.4.9 | Feb 23, 2026 |
| 0.3.9 | Feb 14, 2026 |
#112 in Images
220KB
5.5K
SLoC
image-processing
Overview
image-processing provides a modern SVG-first flow:
svg-validate --in <svg> --out <svg>convert --from-svg <path> --to png|webp|svg --out <file>
generate is removed.
Usage
Usage:
image-processing <subcommand> [flags]
Subcommands:
convert | svg-validate
Help:
image-processing --help
Commands
svg-validate: Validate and sanitize one SVG input into one SVG output.convert: Render trusted SVG source intopng,webp, orsvgoutput.
Common flags
- Input:
svg-validate:--in <path>(exactly one)convert:--from-svg <path>
- Output:
--out <file> - Output controls:
--overwrite,--dry-run,--json,--report - Render sizing for raster output:
--width,--height
convert --from-svg contract (v1)
- Required:
--from-svg,--to png|webp|svg,--out <file>. - Forbidden:
--in. --outextension must match--to.- Optional:
--widthand--heightforpng/webpsizing. --to svgdoes not support--width/--height.
svg-validate contract
- Required: exactly one
--in <svg>and--out <svg>. - Forbidden:
--from-svg,--to,--width,--height. - Output is deterministic for identical input.
Examples
mkdir -p out/plan-doc-examples
cargo run -p nils-image-processing -- svg-validate \
--in crates/image-processing/tests/fixtures/llm-svg-valid.svg \
--out out/plan-doc-examples/llm.cleaned.svg
cargo run -p nils-image-processing -- convert \
--from-svg out/plan-doc-examples/llm.cleaned.svg \
--to png \
--out out/plan-doc-examples/llm.png \
--json
cargo run -p nils-image-processing -- convert \
--from-svg crates/image-processing/tests/fixtures/sample-icon.svg \
--to webp \
--out out/plan-doc-examples/sample.webp \
--width 512 \
--json
Exit codes
0: Success with no item errors.1: Runtime failure or one-or-more items failed.2: Usage/validation error.
Dependencies
convert --from-svgandsvg-validate: no external binary dependency (Rust backend).
Docs
Dependencies
~25MB
~472K SLoC