Compress image
Build a deterministic compression plan for one JPEG/PNG/WebP: quality slider, real export dimensions, EXIF orientation normalization, output bytes and an honest savings report. When output is larger it only says "no savings".
Inputs and parameters
image— Image filequality— Quality (1–100)targetWidth— Target width (px, blank = unchanged)lockAspect— Lock aspect ratiobackgroundColor— Transparency background (#RRGGBB)outputBytes— Measured output bytes (optional, verifies "no savings")
Real example
JPEG 2000×1000, 1,800,000 bytes, quality=75, outputBytes=2,100,000
→ {"output":{"bytes":2100000,"format":"jpeg"},"savings":{"saved":false,"statusText":"no savings","percent":null,"message":"output is 300000 bytes larger than input"}}
Limits and failure handling
One image, 20 MiB / 24 MP budget enforced up front; no upload, no batch. No real codec is wired, so output is a JSON plan (downloadableImage=false) and must not be used as a compressed image; real encoding is untested. AVIF is disabled.
FAQ
Will dragging the quality slider produce multiple outputs?
No. Each run gets a monotonically increasing runId/version; only the newest may commit. Stale results are discarded with STALE_RESULT and never overwrite newer parameters.
Can it show a fake "99% saved"?
No. savingsReport returns percent=null, pseudoPercent=null and a "no savings" status whenever output>=input; a percentage is computed only for a real reduction.