Resizing images
Tinify CDN can resize your images on the fly. In particular, it is possible to resize images to create smaller versions such as thumbnails.
Example
Images can be resized by using query string parameters in the image URL. The following will scale the imagepanda.png
down to be 100 pixels wide, adjusting the height accordingly.
https://xxxxxxxx.tinifycdn.com/panda.png?resize.width=100
Multiple query string parameters can be combined:
https://xxxxxxxx.tinifycdn.com/panda.png?resize.width=100&resize.height=50&resize.method=fit
Resizing options
The parameter resize.method
describes the way your image will be resized. The following methods are available.
resize.method=scale
- Scales the image down proportionally. You must provide either a target
resize.width
or a targetresize.height
parameter, but not both. The scaled image will have exactly the provided width or height. resize.method=fit
- Scales the image down proportionally so that it fits within the given dimensions. You must provide both a
resize.width
andresize.height
parameter. The scaled image will not exceed either of these dimensions. resize.method=cover
- Scales the image proportionally and crops it if necessary so that the result has exactly the given dimensions. You must provide both a
resize.width
andresize.height
parameter. The parts of the image that are cropped away are determined automatically. An intelligent algorithm determines the most important areas of your image. resize.method=thumb
- A more advanced implementation of cover that also detects cut-out images with plain backgrounds. The image is scaled down to the
resize.width
andresize.height
you provide. If an image is detected with a free-standing object it will add more background space where necessary or crop the unimportant parts.
Please note that if the target dimensions are larger than the original dimensions, the image will not be scaled up. Scaling up is prevented to protect the quality of your images.