User:Dan Pelleg/Sandbox/Template:Crop
Appearance
Use this template to display a selected rectangular portion of an image, either not zoomed (in actual pixel size), zoomed in (enlarged) or zoomed out (scaled down).
Specify all of the following parameters (use no quotation marks for the file name, no "px" for the length specifications and no "%" sign for the zoom factor):
parameter name | function | usage example |
---|---|---|
image_name | name of the file | image_name=Creation-of-adam.PNG |
image_width | actual width in pixels of the entire image (specified on the file's page under the preview at "Full resolution") | image_width=1280 |
image_height | actual height in pixels of the entire image (specified on the file's page under the preview at "Full resolution") | image_height=786 |
selection_width | width of portion to be displayed in pixels (not zoomed) | selection_width=220 |
selection_height | height of portion to be displayed in pixels (not zoomed) | selection_height=132 |
offset_x | distance from left edge of image to beginning of selected portion in pixels (not zoomed) | offset_x=412 |
offset_y | distance from top edge of image to beginning of selected portion in pixels (not zoomed) | offset_y=300 |
zoom_percent | scales all other parameters, e.g.: 100 displays actual pixel size and renders all measurements unchanged, 50 renders all measurements at half their value and displays the selected portion resampled to half its width and height, 200 renders all measurements at twice their value and displays the selected portion resampled to double its width and height etc. | zoom_percent=100 |
Simple usage example (zoom factor 100%):
usage | syntax | result |
---|---|---|
Standard display of file:Creation-of-adam.PNG scaled down by width specification of 220 pixels | [[file:Creation-of-adam.PNG|220px]] | |
Selected cropped portion of same file, 220 pixels wide, in actual pixel size of given image, | {{User:Dan Pelleg/Sandbox/Template:Crop
|image_name=Creation-of-adam.PNG |image_width=1280 |image_height=786 |selection_width=220 |selection_height=132 |offset_x=412 |offset_y=300 |zoom_percent=100 }} |
|
Usage examples with different zoom factors:
zoom factor in % | syntax | result |
---|---|---|
25 | {{User:Dan Pelleg/Sandbox/Template:Crop
|image_name=Creation-of-adam.PNG |image_width=1280 |image_height=786 |selection_width=880 |selection_height=528 |offset_x=82 |offset_y=103 |zoom_percent=25 }} |
|
50 | {{User:Dan Pelleg/Sandbox/Template:Crop
|image_name=Creation-of-adam.PNG |image_width=1280 |image_height=786 |selection_width=440 |selection_height=264 |offset_x=302 |offset_y=235 |zoom_percent=50 }} |
|
100 | {{User:Dan Pelleg/Sandbox/Template:Crop
|image_name=Creation-of-adam.PNG |image_width=1280 |image_height=786 |selection_width=220 |selection_height=132 |offset_x=412 |offset_y=300 |zoom_percent=100 }} |
|
200 | {{User:Dan Pelleg/Sandbox/Template:Crop
|image_name=Creation-of-adam.PNG |image_width=1280 |image_height=786 |selection_width=110 |selection_height=66 |offset_x=467 |offset_y=333 |zoom_percent=200 }} |
|
400 | {{User:Dan Pelleg/Sandbox/Template:Crop
|image_name=Creation-of-adam.PNG |image_width=1280 |image_height=786 |selection_width=55 |selection_height=33 |offset_x=495 |offset_y=350 |zoom_percent=400 }} |
|