Resizing & Cropping

Control image dimensions with powerful resize and crop options.

aspect_ratio

Basic Resizing

Use w and h parameters to set dimensions.

ParameterAliasValuesDescription
wwidth1-8192Width in pixels
hheight1-8192Height in pixels
Examples
# Width only (height auto-calculated)
?w=800

# Height only (width auto-calculated)
?h=600

# Both dimensions
?w=800&h=600
crop

Fit Modes

Control how the image fits within the specified dimensions using the fit parameter.

fit=coverDefault

Crop to fill the entire area. Image may be cropped to fit.

fit=contain

Fit entire image within dimensions. May have padding/letterboxing.

fit=fill

Stretch to fill exact dimensions. May distort the image.

fit=inside

Resize to fit inside dimensions without enlarging.

fit=outside

Resize to cover at minimum the specified dimensions.

# Cover mode (crop to fill)
?w=400&h=300&fit=cover

# Contain mode (fit within)
?w=400&h=300&fit=contain
filter_center_focus

Gravity & Focus

When cropping, use g (gravity) to specify the focal point.

ValueDescription
centerCenter of the image (default)
northTop center
southBottom center
eastRight center
westLeft center
autoAutomatic content-aware cropping
faceFocus on detected faces (Enterprise)
# Crop from top
?w=400&h=300&fit=cover&g=north

# Smart face detection
?w=400&h=400&fit=cover&g=face
photo_size_select_large

Aspect Ratio

Force a specific aspect ratio using the ar parameter.

# 16:9 aspect ratio
?w=800&ar=16:9

# Square (1:1)
?w=400&ar=1:1

# Portrait (3:4)
?w=600&ar=3:4
16:9

Widescreen

4:3

Standard

1:1

Square

9:16

Stories

smartphone

DPR (Retina Support)

Use dpr for high-density displays. The actual output size will be multiplied by the DPR value.

# 2x for retina displays (outputs 800x600 actual pixels)
?w=400&h=300&dpr=2

# 3x for high-density mobile
?w=400&h=300&dpr=3
tips_and_updates

Pro Tip

Combine with srcset for automatic retina image serving based on device capabilities.