Image Optimization

Tilda Image Optimization allows you to compress and transform your images on the fly using a specially-formatted URL. This means that the only code changes you need to make in your project is to update the image URLs.

Next.js Integration

If you're using Next.js, you don't need to make any changes to your code. Tilda automatically integrates with Next.js's built-in Image Optimization features. Just use the Next.js Image component or next/image as you normally would, and Tilda will handle the optimization automatically.

Example Next.js Image Usage
JSX
import Image from 'next/image'

export default function Page() {
  return (
    <Image
      src="/path/to/your/image.jpg"
      alt="Your image"
      width={500}
      height={300}
    />
  )
}

URL Format

For non-Next.js applications, or if you need more control over the optimization parameters, you can use our URL-based API:

Tilda Image Optimization URL is as follows:

https://<DOMAIN NAME>/_tilda/image/<OPTIONS>/<IMAGE URL>

Here is an explanation of each of the URL parts:

The URL can be a relative one if used on the same website or an absolute one. For example, an absolute URL will look like this:

https://example.com/_tilda/image/width=400,format=avif/path/to/local/image.jpg

And a relative URL will look like this:

/_tilda/image/width=400,format=auto/path/to/local/image.jpg

These URLs can be used in different context. For example, an <img> tag:

Example <img> tag
HTML
<img src="/_tilda/image/width=400,format=avif/path/to/local/image.jpg" alt="An optimized image">

Supported options

You must specify at least one option. Multiple options for image transformation can be added as a comma seperated list. Spaces are not allowed in options.

Quality and Format

Resizing Options

Effects

Error handling

Use onerror=redirect to redirect the request to original image URL incase there are fatal errors with fetching or transforming the image. For example:

https://example.com/_tilda/image/width=400,onerror=redirect/path/to/local/image.jpg

This option is ignored if the image is from another domain, but you can use it with subdomains.