Output format negotiation and perceptual quality optimization.
Format & Quality
Output format
| Param | Format | Browser support |
|---|---|---|
f=jpeg | JPEG | Universal |
f=png | PNG | Universal |
f=webp | WebP | Chrome, Firefox, Safari 14+, Edge |
f=avif | AVIF | Chrome 85+, Firefox 93+, Safari 16.4+ |
f=jxl | JPEG XL | Chrome (with flag), Safari 17+ |
f=auto | Best for browser | Negotiated via Accept header |
?f=webp → always WebP
?f=auto → best format for the requesting browser
Recommendation: Use f=auto (or omit f entirely) and let the CDN pick the best format based on the browser's Accept header. The negotiation order is: JXL > AVIF > WebP > JPEG.
Quality
Numeric quality (1-100)
Direct control over compression level. Higher = larger file, better quality.
?q=80 → quality 80 (good default)
?q=50 → aggressive compression
?q=95 → near-lossless
Semantic quality modes
Spronta uses SSIMULACRA2 — a perceptual quality metric — to find the optimal compression level for each image. Instead of guessing a quality number, tell Spronta what you want:
| Mode | SSIMULACRA2 target | Best for |
|---|---|---|
q=high | 80 | Photography, hero images, product shots |
q=medium | 65 | General web content (recommended) |
q=low | 50 | Thumbnails, previews, aggressive compression |
?q=medium → perceptually calibrated compression
?q=high → best quality, larger files
?q=low → smallest files, good for thumbnails
How perceptual quality works
- Spronta encodes the image at a trial quality level
- Measures the SSIMULACRA2 score (how similar to the original)
- Binary searches to find the quality that matches your target score
- Caches the calibrated quality on the source image metadata for next time
The result: every image is compressed to the exact perceptual threshold you chose, regardless of content complexity. A simple graphic and a detailed photo both look equally good at q=medium, but the graphic will be much smaller.
JPEG-specific tuning
Advanced users can fine-tune JPEG frequency band compression:
| Param | Description | Default |
|---|---|---|
jq_lf | Low-frequency scale | 1.0 |
jq_mf | Mid-frequency scale | 1.0 |
jq_hf | High-frequency scale | 1.0 |
jq_cf | Chroma scale | 1.0 |
Lower values = more compression in that frequency band. Values below 1.0 are more aggressive, above 1.0 preserves more detail.