image-budget
Compress an image to a byte budget in the browser - and find out what actually happened.
pnpm add image-budgetSilence becomes data
Ask for AVIF and get PNG, and nothing throws. So the format is read back off the blob, and result.degraded is empty only when the output is exactly what you asked for.
A byte budget, not a quality number
Quality is bisected to the largest size that fits, then the image is shrunk if quality alone cannot get there. Two axes, a capped attempt count, and the count is reported.
HEIC without shipping libheif
Detected from the file's magic bytes, since iOS often leaves the mime type blank, and decoded through heic-to imported on demand.
Zero dependencies by default
The canvas engine is native. WASM codecs live behind a separate entry point, so AVIF costs a bundle only where it is used.