Rust library
The oximg::pipeline module is usable without the HTTP server —
process/process_path take a Params and return the re-encoded
bytes plus their format, probe reads just the header (probe_header
adds the EXIF orientation and the displayed size), and
probe_animation reports frame count, play time, loop count and (for a
GIF) the decode work OXIMG_MAX_ANIM_DECODE_WORK is compared against,
for an animated source (GIF and WebP) without decoding pixels. Depend on it
with default-features = false to drop the entire HTTP stack (axum,
tokio, reqwest, hmac, sha2, serde_json); add features = ["avif"]
for AVIF. The remote-source functions need the server feature:
fetch_url/fetch_gcs/fetch_s3 download a bounded buffer (with
_async variants for callers already inside a runtime), and
process_url/process_gcs/process_s3 are fetch-then-decode in one
call.
Failures are typed: every entry point returns pipeline::Error, whose
kind() (ErrorKind: SourceNotFound / SourceTooLarge /
SourceUnreadable / Upstream / UpstreamTimeout / Undecodable /
Internal) is the stable classification the server’s own status mapping
is built on — match on it instead of parsing messages, with a wildcard
arm for kinds added later. Params also carries per-call overrides
(webp_quality, png_effort, png_quantize, auto_rotate, icc,
flatten_bg, linear_light, avif_quality, …) for the knobs that
are otherwise process-global environment variables: None keeps the
env-configured behavior, Some wins per call — so one process can run
different settings side by side. Rustdoc examples on probe,
process, and Params are compiled and run in CI; see also
examples/:
cargo run --release --example thumbnail -- photo.jpg 300 200 out.jpgcargo run --release --example transcode -- photo.jpg 800 800 webp out.webpcargo run --release --example probe -- photo.webp