The filter |image_recadre crop an image to absolute dimensions or proportions.

## Uses

This filter can be applied to

## Crop to absolute dimensions

The arguments are:

1. width;
2. height;
3. position (optional) :
• `center`, `left`, `right`, `top`, `bottom`;
• or combinations of several `top left`;
• or an indication in pixels from a position `top=50` or composed `top=40 left=50`;
• or the name of a special function that will calculate and return the desired position.
4. the background colour (optional) argument is useful if you enlarge the image.

## Examples with absolute dimensions

Crop the original image into a square of 90 px width and height based on the centre of the image.

|image_recadre also allows to enlarge an image file, the background is then specified by a colour or ’transparent’ as the 4th argument:

## Crop to proportions

(Since SPIP 3.0.19 )

Arguments are:

1. proportions : ratio width:height required;
2. +|- : ’+’ to enlarge with stripes, ’-’ to reduce. (if ’-’ is applied, it is equivalent to |image_passe_partout);
3. position (optional) : Cutting position indication:
• `center`, `left`, `right`, `top`, `bottom`;
• or combinations of several `top left`;
• or an indication in pixels from a position `top=50` or composed `top=40 left=50`;
• or the name of a special function that will calculate and return the desired position.
4. background colour (optional), argument is useful if you enlarge the image.

## Examples with proportions

Allows you to have a logo in 16:9 format with as little cropping of the image as possible.
This keeps the image as large as possible while keeping to a proportion.

Example