Skip to content

Tools: encoders & metrics

Terminal window
cjpeg -quality 85 input.ppm > output.jpg
  • Quality range: 0–100 (typical: 75–95)
  • Input: PPM format (use convert or Pillow to prepare)
  • Sampling factor: -sample 2x2 (4:2:0) or -sample 1x1 (4:4:4)
Terminal window
cwebp -q 85 input.png -o output.webp
  • Quality range: 0–100 (typical: 75–95)
  • Method (-m): 0–6 (higher = slower, better compression)
  • Sharp YUV conversion: -sharp_yuv
  • Input: PNG or JPEG
Terminal window
avifenc -s 4 -q 60 input.png output.avif
  • Quality (-q): 0–100 (typical: 50–85, very efficient at lower values)
  • Speed (-s): 0–10 (higher = faster, lower quality; default: 6)
  • YUV format: -y 420, -y 444
Terminal window
cjxl input.png output.jxl -q 85
  • Quality range: 0–100 (typical: 75–95)
  • Effort (-e): 1–10 (higher = slower, better compression)
  • Also supports distance mode (-d)
Terminal window
avifdec input.avif output.png

Used by the quality measurement pipeline to decode AVIF files back to PNG for metric computation.

Terminal window
djxl input.jxl output.png

Used by the quality measurement pipeline to decode JXL files back to PNG for metric computation.

JPEG and WebP are decoded via Pillow (no separate CLI decoder needed).

Perceptual quality metric designed specifically for lossy image compression. Higher is better.

Terminal window
ssimulacra2 original.png compressed.png
ScoreQuality
90+Visually lossless
70–90Excellent
50–70Good
30–50Medium
< 30Poor

Perceptual distance metric that models the human visual system. Lower is better.

Terminal window
butteraugli_main reference.png distorted.png
ScoreQuality
< 1.0Excellent (imperceptible)
1.0–2.0Good (minor artifacts)
2.0–3.0Medium (noticeable)
> 3.0Poor

Included in the JPEG XL static binaries.

Peak Signal-to-Noise Ratio in dB. Higher is better.

Terminal window
ffmpeg -i original.png -i compressed.png -lavfi psnr -f null -
ScoreQuality
40+ dBExcellent
30–40 dBGood
20–30 dBFair
< 20 dBPoor

Structural Similarity Index (0–1). Higher is better.

Terminal window
ffmpeg -i original.png -i compressed.png -lavfi ssim -f null -
ScoreQuality
0.95–1.0Excellent
0.90–0.95Good
0.80–0.90Fair
< 0.80Poor

All encoders, decoders and metric tools are pre-installed in the dev container and available on PATH. Check versions with:

Terminal window
cjpeg -version
cwebp -version
avifenc --version
cjxl --version
ffmpeg -version
ssimulacra2 # prints usage if no args