Resize
Resize an image by specifying a target geometry. By default, aspect ratio is preserved.
Syntax
Command | Argument Format |
---|---|
resize | <width>x<height>[!] |
<width>
and<height>
are integers.!
(optional) forces exact dimensions, disabling aspect ratio preservation.^
(optional) similar to!
, but may output an image larger than the requested size. Use this in combination withcrop
to ensure the image is cropped to the requested size.
Behavior
-
Without
!
— image is resized to fit within the specified box, preserving its aspect ratio. The output may be smaller than requested in one dimension. -
With
!
— image is resized to exactly match the specified dimensions, which may result in stretching or squishing.
Examples
Forced Resize (with !
)
Proportional Resize (no !
)
URL Escaping
Some geometry formats include symbols like %
that must be URL-encoded.
- For example, to resize to 15% of the original size:
Useresize/15%25
, where%25
is the encoded form of%
.
Always ensure resize arguments are properly escaped when constructing URLs.