Output format negotiation and perceptual quality optimization.

Format & Quality

Output format

ParamFormatBrowser support
f=jpegJPEGUniversal
f=pngPNGUniversal
f=webpWebPChrome, Firefox, Safari 14+, Edge
f=avifAVIFChrome 85+, Firefox 93+, Safari 16.4+
f=jxlJPEG XLChrome (with flag), Safari 17+
f=autoBest for browserNegotiated 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:

ModeSSIMULACRA2 targetBest for
q=high80Photography, hero images, product shots
q=medium65General web content (recommended)
q=low50Thumbnails, 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

  1. Spronta encodes the image at a trial quality level
  2. Measures the SSIMULACRA2 score (how similar to the original)
  3. Binary searches to find the quality that matches your target score
  4. 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:

ParamDescriptionDefault
jq_lfLow-frequency scale1.0
jq_mfMid-frequency scale1.0
jq_hfHigh-frequency scale1.0
jq_cfChroma scale1.0

Lower values = more compression in that frequency band. Values below 1.0 are more aggressive, above 1.0 preserves more detail.