Convert format
Convert between JPEG / PNG / WebP while validating MIME, extension, declared format and actual byte format; transparent → JPEG requires a user-selected background. AVIF is refused without a verified codec.
Inputs and parameters
image— Image filetargetFormat— Target formatbackgroundColor— Transparency background (#RRGGBB)quality— Quality (1–100)lockAspect— Lock aspect ratio
Real example
PNG 800×600, alpha=true, targetFormat=jpeg, backgroundColor=#3366CC
→ {"background":{"required":true,"color":"#3366CC","rgb":[51,102,204],"alphaRemoved":true},"output":{"format":"jpeg","mime":"image/jpeg","ext":"jpg","alpha":false,"envelopeConsistent":true}}
Limits and failure handling
A target format must be selected explicitly; unverified formats such as AVIF and JXL are not offered and no disguised file is ever emitted. No real encoded bytes exist this round — output is a validated JSON plan; real format conversion is untested.
FAQ
Will it download a PNG renamed to .avif?
No. Unverified AVIF raises AVIF_UNAVAILABLE; validateOutputEnvelope also raises FORMAT_MISMATCH when actualFormat differs from declaredFormat, refusing disguised output.
How are MIME and extension checked?
JPEG→image/jpeg/.jpg, PNG→image/png/.png, WebP→image/webp/.webp; the filename suffix must also match or EXT_MISMATCH / FILENAME_MISMATCH is returned.