Template:Image crop
Appearance
Crops, reframes, zooms and resizes an image without re-uploading it.
The image file itself is never altered. The framing is done with CSS, so the same Commons file can be shown differently on different pages, and a better crop is one edit away rather than a new upload.
Usage
{{Image crop
| image = Satya Nadella headshot.jpg
| width = 300
| ratio = 4x3
| focus = face
| zoom = 1
| align = right
| alt = Portrait of Satya Nadella
| caption = Satya Nadella in 2017
}}
Parameters
| Parameter | Default | Accepts | Notes |
|---|---|---|---|
image |
none | a file name on Commons or uploaded here | Do not include the File: prefix.
|
width |
300 |
a number in pixels | The displayed width. Height follows from ratio.
|
ratio |
4x3 |
square, 4x3, 3x2, 16x9, portrait |
The shape of the frame. |
focus |
face |
top, face, center, bottom, left, right |
Which part of the image stays visible when the rest is cropped away. face keeps the eyes near the upper third, which suits most portraits.
|
zoom |
1 |
1 to about 2 |
Magnification. 1.2 crops in by 20 per cent. Useful when a subject sits small in a wide frame.
|
align |
none | left, right |
Floats the image. Leave blank to keep it in the flow. |
alt |
none | text | Alternative text. Please fill this in. |
caption |
none | text | Optional caption below the image. |
Examples
A wide photograph reframed as a square portrait, zoomed in on the face:
{{Image crop | image = Jensen Huang 2023.jpg | ratio = square | focus = face | zoom = 1.3 | width = 220 }}
A tall portrait shown as a 16:9 banner, keeping the top of the frame:
{{Image crop | image = Example.jpg | ratio = 16x9 | focus = top | width = 600 }}
Notes
- If a subject looks off centre, adjust
focusfirst, thenzoom. - Cropping is visual only. Screen readers still receive the
alttext, and the underlying file is unchanged. - For infobox portraits use the ordinary
image =field of Template:Tl instead. This template is for article body images, galleries and landing pages.