Resize Strategies
The examples below show how the resize_strategy
impacts resizing a 400×300 pixel image to 100×100
pixels:
fit
Uses the larger side of the original image as a base for the resize. Aspect ratio is preserved. Either side will become at most 100 pixels.
For example: resizing a 400×300 image into 100×100, would produce a 100×75 image.
fillcrop
Scales the image to fit into our 100×100 target while preserving aspect ratio, while trimming away any excess surface. This means both sides will become exactly 100 pixels, at the tradeoff of destroying parts of the image.
By default the resulting image is horizontally/vertically centered to fill the target rectangle. Use
the gravity
parameter to change where to crop the image, such as "bottom"
or "left"
.
min_fit
Uses the smaller side of the original image as a base for the resize. After resizing, the larger side will have a larger value than specified. Aspect ratio is preserved. Either side will become at least 100 pixels.
For example: resizing a 400×300 image into 100×100, would produce a 133×100 image.
pad
Scales the image to fit while preserving aspect ratio. Both sides of the resized image become exactly 100 pixels, and any remaining surface is filled with a background color.
In this example, the background color is determined by the
Assembly Variable
${file.meta.average_color}
. If you set zoom
to false
(default is true
), smaller images will
be centered horizontally and vertically, and have the background padding all around them.
stretch
Ignores aspect ratio, resizing the image to the exact width and height specified. This may result in a stretched or distorted image.
crop
Cuts an area out of an image, discarding any overlapping parts. If the source image is smaller than
the crop frame, it will be zoomed. This strategy is implied when you specify coordinates in the
crop
parameter, and cannot be used without it.
To crop around human faces, see 🤖/image/facedetect instead.