Ordnary technology · Coming to R2
Nyquist™
The technology behind Optimize images in R2. For every image it finds the smallest AVIF, WebP or JPEG that still looks exactly like the original.
Most websites compress every image with the same setting. That setting is too strict for a sky and too loose for small text, so some files are far bigger than they need to be and others look worse than they should.
One decision per image
Nyquist doesn't guess. It encodes, measures how the result looks to a person, and keeps the smallest version that passes.
- 01
Measure
A perceptual quality metric, SSIMULACRA 2, scores how close each encoded version looks to the original.
- 02
Search
For AVIF, WebP and JPEG, a short search finds the lowest quality that still passes. A few tries per format are enough.
- 03
Serve
R2 keeps the versions that are smaller than the original and serves the smallest format each browser supports.
What it saves
Measured on 120 photos at every quality step from 50 to 100 (and confirmed in coarser steps on 400), against the best single setting that keeps 95% of them visually identical (SSIMULACRA 2 at 80 or higher).
We also tested whether a trained model could do better by choosing a quality for every region of an image. It couldn't: the encoders' own tuning already does that, so Nyquist uses them and keeps the search.
- 25%
- smaller JPEG files on average, and 44% when the setting has to keep 99% of photos identical.
- 13%
- smaller AVIF files, and 23% at 99%. AVIF is already the most efficient format.
- 11%
- smaller WebP files, and 16% at 99%.
Roadmap
No release date. Each step happens when the one before it is done.
- 01 Done
Measure
Per-image choice against one fixed setting, and a per-region model against the encoders' own tuning, on openly licensed photos.
- 02 Next
Build into R2
An encoder service that optimizes images the first time they're requested from a public bucket, and edge caching for every public file.
- 03 Planned
Optimize images
A setting per bucket in the console. Turn it on and images on your public domain are served at their smallest size.
- 04 Later
More
Resizing on request, and screenshots and product photos, where the savings are likely larger.
Questions
About R2When is it available?
When it's built and tested in R2. It will appear as Optimize images in your bucket settings.
Does it change how my images look?
That's the one thing it must not do. Every version is checked against the original with a perceptual quality metric, and only versions that pass are served. Your original stays untouched.
Is it AI?
No. We tested a trained model and it didn't beat a careful search with the best encoders. So Nyquist measures every image instead of predicting.
Why the name?
After Harry Nyquist, whose sampling theorem says how much of a signal you need to keep to reproduce it exactly. Nyquist asks the same question for every image.