Description
This template lets you crop an image to any size at any position.
Parameters
| Parameter
|
Description
|
| Image
|
image
|
The image file name, including its extension.
|
| Image size
|
size
|
Full size of the image before cropping. Defaults to 150px.
|
| Width
|
w
|
Crop width. Controls how visible horizontal crop area is.
|
| Height
|
h
|
Crop height. Controls the visible vertical crop area is.
|
| Left
|
left
|
Shifts the crop area from the left edge. Defaults at the top left corner.
|
| Top
|
top
|
Shifts the crop area from the top edge. Defaults at the top left corner.
|
Example
| Imagine you have a 150px × 150px image, but you only want the center 50px region visible (the blue area).
|
|
Step 1: Set the crop size
First, decide how big your final cropped image should be. Since the blue block is 50px × 50px, set both width (w) and height (h) to 50px.
|
Input:
{{ImageCrop|image=Template-imagecrop.png|size=150px|w=50px|h=50px}}
Output:
|
Step 2: Adjust the position
Now the image has the right size, but as you can see, it is in the wrong position because it displays the top-left corner (block a1). To shift the focus to the center blue block, adjust the left and top offsets.
On a 150px × 150px image divided into a grid of 50px sections, the central block starts 50 pixels in from each edge. Set both left=50px and top=50px to push the crop box inward and isolate the center block.
|
Input:
{{ImageCrop|image=Template-imagecrop.png|size=150px|w=50px|h=50px|left=50px|top=50px}}
Output:
|
| Further examples
|
| Here is an example showing all three center row blocks (b1 to b3).
|
Input:
{{ImageCrop|image=Template-imagecrop.png|size=150px|w=150px|h=50px|left=|top=50px}}
Output:
|
| Here is an example showing all three left-side column blocks (a1, b1, and c1).
|
Input:
{{ImageCrop|image=Template-imagecrop.png|size=150px|w=50px|h=150px|left=|top=}}
Output:
|
| Here is an example showing only a quarter of the blue block area.
|
Input:
{{ImageCrop|image=Template-imagecrop.png|size=150px|w=25px|h=25px|left=50px|top=50px}}
Output:
|