fit

The fit parameter controls how the image will be constrained within the provided size (width and height) values, in order to maintain the correct proportions.

Syntax

fit={value}

Allowed values

ValueDescription
boundsResize the image to fit entirely within the specified region, making one dimension smaller if needed.
coverResize the image to entirely cover the specified region, making one dimension larger if needed.
cropResize and crop the image centrally to exactly fit the specified region.

Notes

The fit parameter has no effect unless both width and height are specified.

Examples

Click the links to view the transformed image using a demo Fastly IO service.

Example usageDescription
?width=150&height=150&fit=boundsResize the image to fit within the bounds of 150px in width by 150px in height
?width=150&height=150&fit=coverResize the image to entirely cover 150px in width by 150px in height
?width=150&height=150&fit=cropCrop the image to 150px in width by 150px in height