Codecs
January 14, 2026·6 min read

How Trellis Quantization Improves JPEG Quality

Understanding how trellis quantization in MozJPEG reduces blocking artifacts at low quality settings.

MV

Marcus Vance

Contributing Author · Squoosh Next Blog

Trellis quantization is an optimization technique borrowed from video encoding that searches for the quantized DCT coefficients that minimize distortion at a given bit rate. Standard JPEG quantization simply rounds each DCT coefficient to the nearest quantization step, which is fast but sub-optimal. Trellis quantization instead evaluates multiple candidate quantized values and selects the combination that produces the best rate-distortion tradeoff.

In MozJPEG, enabling trellis quantization can reduce file size by a further 4–8% at the same visual quality compared to libjpeg-turbo without trellis. The tradeoff is encoding speed — trellis adds 20–30% to compression time. For batch processing pipelines where encode time is less critical than output quality, always enable trellis.

For real-time interactive compression, disable it for responsiveness.

Key Takeaways
  • Trellis quantization is an optimization technique borrowed from video encoding that searches for the quantized DCT coefficients that minimize distortion at a given bit rate.

  • Standard JPEG quantization simply rounds each DCT coefficient to the nearest quantization step, which is fast but sub-optimal.

  • Trellis quantization instead evaluates multiple candidate quantized values and selects the combination that produces the best rate-distortion tradeoff.

  • In MozJPEG, enabling trellis quantization can reduce file size by a further 4–8% at the same visual quality compared to libjpeg-turbo without trellis.

Try It in the Workspace

Everything discussed in this article can be tested directly in Squoosh Next — no sign-up, no upload, 100% client-side.

More in Codecs
AVIF vs WebP: The Next-Gen Image Format Showdown
June 12, 2026 · 6 min read
Optimizing PNGs with OxiPNG and pngquant
May 14, 2026 · 7 min read
A Deep-Dive into JPEG XL (JXL)
March 05, 2026 · 8 min read
Squoosh Next

Professional client-side image compression and format optimization tool. Compress, convert, and adjust 100+ formats instantly without server uploads.


© 2026 Squoosh Next. Developed & Maintained by Naushad Alam | Zest Tech Solution | Powered by Vercel.Contact: Naushad Alam | WhatsApp: 7492068998 | Email: contact@zestcommerce.in | Web: zesttechsolution.cloud
Security EncryptedNo Uploads
Operational
v2.1.0Commit: d05d63e
0s
Build Info
Environment: productionBranch: masterBuild Time: 25s
Deployment
Deployed: 7/13/2026, 1:25:22 AMUptime: 0sPlatform: Vercel
Performance
Response: 0msStatus: OnlineSSL: Active
Technology
Next.js: 16.2.9React: 19.0.0TypeScript: 5.0