Docs Ordnary Cloud Ordnary R2
Optimize images
Serve images on a bucket's public domain as the smallest AVIF, WebP or JPEG that looks the same as the original, powered by Nyquist.
What it does
With Optimize images on, every JPEG, PNG or WebP image requested on the bucket's public domain is served in the smallest format and size that still looks the same: AVIF, WebP or JPEG, depending on what the visitor's browser accepts. Nyquist measures how the result looks to a person, so images get as small as they can without a visible difference. See Nyquist for how it works.
Your original files are never changed. Anything that reads the bucket over the S3 API, or another public URL of the bucket, keeps getting the originals.
Turn it on
- 1
Give the bucket a public domain
Optimize images only works on a public domain: a name on r2.ordnary.com or your own domain. See Public access and domains.
- 2
Open the bucket's Settings
In the console, open the bucket and go to Settings, Optimize images.
- 3
Switch it on
Turn on Optimize images. It applies to images requested from that moment on.
How images are optimized
Each image is optimized the first time it is requested, so the first few visitors get the original while the smaller version is made. After that, every visitor gets the optimized version. Public files are cached at the edge; when you overwrite an image, the old version can be served until the cache expires.
| Details | |
|---|---|
| Images | JPEG, PNG and WebP. Other files are served as they are. |
| Formats served | AVIF, WebP or JPEG, whichever the browser accepts and is smallest. |
| Where | The bucket's public domain only, not the S3 endpoint. |
| Price | Included at no extra cost. |