**SPIP**
# Article submitted
The article "**|image_recadre**
(https://www.spip.net/ecrire/?exec=article&id_article=6543)" is submitted
for publication. on Tuesday 12 May 2020.
* * *
## |image_recadre
Tuesday 12 May 2020 , by [jack](.././?page=auteur&id_auteur=593&)
The filter `|image_recadre` crop an image to absolute dimensions or
proportions.
## Uses
This filter can be applied to
* the path of the image (balise #FICHIER
(https://www.spip.net/ecrire/?exec=article&id_article=4342))
* an html tag `` `<img src=... />` `` (See Les balises #LOGO\_XXX
(https://www.spip.net/ecrire/?exec=article&id_article=6461) or the filter
|balise\_img (https://www.spip.net/ecrire/?exec=article&id_article=4003))
## Crop to absolute dimensions
The arguments are:
`|image_recadre{width, height, position, background color}`
1. **width**;
2. **height**;
3. **position** (optional) :
* \`center\`, \`left\`, \`right\`, \`top\`, \`bottom\`;
* or combinations of several \`top left\`;
* or indication in pixels from a position \`top=50\` or composed
\`top=40 left=50\`;
* or name of a special function that will calculate and return the
desired position.
4. **background color** (optional), argument is useful if you enlarge the
image.
## Examples with absolute dimensions
[
(
#FICHIER
|image_recadre
{800, 400}
)
]
[
(
#LOGO_ARTICLE
|image_recadre
{800, 400, center}
)
]
[
(
#LOGO_RUBRIQUE
|image_recadre
{800, 400, center, black}
)
]
1. [ ( #FICHIER |image_recadre {90,90,center} ) ]
**|image_recadre{90,90,center}**
Crop the original image into a square of 90 px width and height based on
the center of the image.
`|image_recadre` also allows to enlarge an image file, the background is
then specified by a color or ’transparent’ as the 4th argument:
1. [ ( #FICHIER |image_recadre {500,300,'top left',' #663399 '} ) ]
**|image_recadre{500,300,’top left’,’#663399’}**
## Crop to proportions
(Since SPIP 3.0.19 )
Arguments are:
`|image_recadre{proportions, +|-, position, background color}`
1. **proportions** : ratio *largeur:hauteur* required;
2. **+|-** : ’+’ to enlarge with stripes, ’-’ to reduce. (if
’-’ is applied, it is equivalent to |image\_passe\_partout
(https://www.spip.net/ecrire/?exec=article&id_article=4562));
3. **position** (optional) : Cutting position indication:
* \`center\`, \`left\`, \`right\`, \`top\`, \`bottom\`;
* or combinations of several \`top left\`;
* or indication in pixels from a position \`top=50\` or composed
\`top=40 left=50\`;
* or name of a special function that will calculate and return the
desired position.
4. **background color** (optional), argument is useful if you enlarge the
image.
## Examples with proportions
[
(
#FICHIER
|image_recadre
{16:9, '-'}
)
]
[
(
#LOGO_BREVE
|image_recadre
{1:1, '-', center}
)
]
[
(
#FICHIER
|image_recadre
{16:9, -, top left}
)
]
[
(
#FICHIER
|image_recadre
{16:9, -, top=40 left=20}
)
]
[
(
#FICHIER
|image_recadre
{16:9, +, center, white}
)
]
**|image_recadre{16:9,’-’}**
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 that respects a proportion.
Exemple
1. [ ( #LOGO\_ARTICLE |image\_recadre {1:1,-,center top} ) ]
**|image_recadre{1:1,’-’,’center top’}**
## See also
**The filters**
* |image_reduire
(https://www.spip.net/ecrire/?exec=article&id_article=6364)
* |image\_reduire\_par
(https://www.spip.net/ecrire/?exec=article&id_article=6365)
* |image\_passe\_partout
(https://www.spip.net/ecrire/?exec=article&id_article=4562)
The article on the Traitement automatisé des images
(https://www.spip.net/ecrire/?exec=article&id_article=3327), also detailing
many other image filters.
— Sent by SPIP (https://www.spip.net/)
