Resizing & Cropping
Control image dimensions with powerful resize and crop options.
Basic Resizing
Use w and h parameters to set dimensions.
| Parameter | Alias | Values | Description |
|---|---|---|---|
w | width | 1-8192 | Width in pixels |
h | height | 1-8192 | Height in pixels |
# Width only (height auto-calculated)
?w=800
# Height only (width auto-calculated)
?h=600
# Both dimensions
?w=800&h=600Fit Modes
Control how the image fits within the specified dimensions using the fit parameter.
fit=coverDefaultCrop to fill the entire area. Image may be cropped to fit.
fit=containFit entire image within dimensions. May have padding/letterboxing.
fit=fillStretch to fill exact dimensions. May distort the image.
fit=insideResize to fit inside dimensions without enlarging.
fit=outsideResize 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=containGravity & Focus
When cropping, use g (gravity) to specify the focal point.
| Value | Description |
|---|---|
center | Center of the image (default) |
north | Top center |
south | Bottom center |
east | Right center |
west | Left center |
auto | Automatic content-aware cropping |
face | Focus 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=faceAspect 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:416:9Widescreen
4:3Standard
1:1Square
9:16Stories
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=3Pro Tip
Combine with srcset for automatic retina image serving based on device capabilities.