Image Transformations
Fluid serves theme images through ImageKit, which can resize, crop, and reformat images on the fly. The image_url and img_url Liquid filters turn transformation options into an ImageKit URL, so a layout can request exactly the rendition it needs instead of loading the full-size original.
{{ section.settings.image | image_url: "w-600,c-at_max,f-auto,q-80" }}
https://cdn.example.com/products/shirt.jpg → https://cdn.example.com/tr:w-600,c-at_max,f-auto,q-80/products/shirt.jpg
The filters
image_url and img_url behave identically. Both take an image plus one or more transformation options:
- Input — an image object (such as
section.settings.imageorproduct.image), a hash with aurlorsrckey, or a plain URL string. - Output — the image URL with an ImageKit transformation segment (
tr:…) inserted, or the URL unchanged when there is nothing to apply.
img_urlis the older, Shopify-style name;image_urlis preferred for new themes. They are interchangeable on this engine.
Specifying transformations
Pass transformations as a raw ImageKit string, as named parameters, or both.
Raw ImageKit transform string
Pass any ImageKit transformation string. Tokens are comma-separated code-value pairs; whitespace around the commas is ignored.
{{ image | image_url: "w-600,c-at_max,f-auto,q-80" }} {{ image | image_url: "w-600, c-at_max, f-auto, q-80" }} {{ image | image_url: "n-product_card" }}
The first two lines produce the same result (whitespace is ignored); the third applies a named transformation defined in the ImageKit dashboard. This is the most capable option — it supports the full ImageKit vocabulary (focus, blur, effects, overlays, named transformations, and more). See ImageKit's image transformation reference for every parameter.
Named parameters
For common cases, pass named parameters instead of remembering ImageKit codes:
| Parameter | ImageKit code | Example | Produces |
|---|---|---|---|
width | w | width: 600 | w-600 |
height | h | height: 400 | h-400 |
quality | q | quality: 80 | q-80 |
format | f | format: 'auto' | f-auto |
crop | fo (focus) | crop: 'center' | fo-center |
{{ image | image_url: width: 600, height: 400, quality: 80, format: 'auto' }}
→ …/tr:w-600,h-400,q-80,f-auto/…
Notes:
width,height, andformatmirror Shopify'simage_urlfilter.qualityis ImageKit-specific (Shopify has no quality parameter on this filter) and is included as a convenience.cropacceptstop,bottom,left,right, orcenterand maps to ImageKit focus (fo-). Focus only takes effect alongside a resize, socropis ignored unless awidthorheightis also given.- Anything not covered by a named parameter (custom crop modes, blur, effects, and so on) is available through the raw transform string.
Combining both
A raw string and named parameters can be used in the same call:
{{ image | image_url: "f-auto,q-80", width: 600 }}
→ …/tr:f-auto,q-80,w-600/…
Behavior
- Only ImageKit images are transformed. If the resolved URL points to a custom or third-party host (not Fluid's ImageKit), it is returned unchanged and the transformation options are ignored.
- An existing transformation is replaced. If the URL already contains a
tr:segment, it is swapped for the new one. - No options means no change. Calling the filter with no transformation options returns the resolved URL as-is.
Migrating from Shopify size strings
Shopify's img_url accepts size strings such as '300x200', 'medium', or 'master'. These are not supported here — they pass through unchanged, so the image is returned at its original size. Use ImageKit syntax instead:
| Shopify (not supported) | Use instead |
|---|---|
img_url: '300x200' | image_url: "w-300,h-200" or image_url: width: 300, height: 200 |
img_url: '300x300', crop: 'center' | image_url: width: 300, height: 300, crop: 'center' |
img_url: 'master' | image_url with no options (returns the original) |
Examples
Responsive product card with a 2× rendition:
<img src="{{ product.image | image_url: 'w-600,c-at_max,f-auto,q-80' }}" srcset="{{ product.image | image_url: 'w-600,c-at_max,f-auto,q-80' }} 1x, {{ product.image | image_url: 'w-1200,c-at_max,f-auto,q-80' }} 2x" alt="{{ product.title | escape }}" loading="lazy" >
Section setting with an editor-controlled width:
<img src="{{ section.settings.image | image_url: transform }}" alt="" loading="lazy">
Named transformation preset (defined in the ImageKit dashboard):
{{ product.image | image_url: 'n-product_card' }}
Common ImageKit transforms
A quick reference for the raw string — see ImageKit's documentation for the full list:
| Code | Meaning | Example |
|---|---|---|
w- | width (px) | w-600 |
h- | height (px) | h-400 |
q- | quality (1–100) | q-80 |
f- | format | f-auto, f-webp |
c- | crop mode | c-at_max, c-maintain_ratio |
fo- | focus | fo-center, fo-top |
dpr- | device pixel ratio | dpr-2 |
bl- | blur | bl-10 |
ar- | aspect ratio | ar-4-3 |
n- | named transformation | n-product_card |