Image resizer
ARGOplay API has on the fly resizer for JPEG and PNG images.
It available by adding parameters to URLs like this https://api.bear2b.com/media/<image.jpg>
.
Here is the list of supported parameters:
parameter | description | values |
---|---|---|
keep_ratio | preserve the original proportions of an image. By default, the Resizer will get central part of the image and try to fit it to provided width and height | 1-preserve, 0-don't preserve |
width | desired width in pixels | integers |
height | desired height in pixels | integers |
q | quality in percentage | 0-100 |
Examples:
We have original PNG image 1184 × 808 pixels, 64KB - https://api.bear2b.com/media/resizer/original.png
Let's resize it to width 200 pixels and height 100 pixels without keeping ratio: https://api.bear2b.com/media/resizer/original.png?width=200&height=100&keep_ratio=0
To width 200 pixels and height 100 pixels with keeping ratio: https://api.bear2b.com/media/resizer/original.png?width=200&height=100&keep_ratio=1
Fit to width 200 pixels with keeping ratio: https://api.bear2b.com/media/resizer/original.png?width=200&keep_ratio=1
Fit to height 100 pixels with keeping ratio: https://api.bear2b.com/media/resizer/original.png?height=100&keep_ratio=1
Fit to height 200 pixels with keeping ratio and quality 100%. Result file weight is 12KB: https://api.bear2b.com/media/resizer/original.png?height=200&keep_ratio=1&q=100
For havy JPEG images quite often in makes sense to resize and reduce quality as well. E.g. following original 2940 × 1960 image weights 1.8MB. Resized to 300x200 pixels with quality 100% it weights 73KB: https://api.bear2b.com/media/resizer/original_colored.jpg?height=200&keep_ratio=1&q=100
With quality 80% it weight 21KB. Almost 4 times less!: https://api.bear2b.com/media/resizer/original_colored.jpg?height=200&keep_ratio=1&q=80