Documentation: Image Resizing

CheetahO has a great API. The CheetahO can not even optimize images, but also resize them. Image Resizing API is great for creating thumbnails or preview images for your applications. CheetahO first will resize the given image and then optimize it using our optimization algorithm.

Images can be resized using the portraitlandscape or auto strategies. Image will never be enlarged if the supplied width or height parameters are greater than the dimensions of the input image.

To use image resize functionality, add resize parameter to your parameters. Example of JSON parameters to use image resize functionality:

{
    "compression":"lossy",
    "keep_exif":1,
    "web_p":true,
    "url":"https://example.com/image_path.jpg",
    "wait":true,
    "quality":50,
    "resize": {
        "width": 100,
        "height": 75,
        "strategy": "crop"
    }
}

Resizing Strategies

The strategy property can have one of the following values:

exact – Resize to exact width and height. The aspect ratio will not be maintained:

 "resize": {
     "width": 100,
     "height": 75,
     "strategy": "exact"
 }

portrait – Exact height will be set, the width will be adjusted according to aspect ratio:

"resize": {
    "height": 75,
    "strategy": "portrait"
}

landscape – Exact width will be set, height will be adjusted according to aspect ratio:

"resize": {
    "width": 100,
    "strategy": "landscape"
}

auto – The best strategy (portrait or landscape) will be selected according to its aspect ratio:

"resize": {
    "width": 100,
    "height": 75,
    "strategy": "auto"
}

fit – This option will crop and resize your images to fit the desired width and height:

"resize": {
    "width": 100,
    "height": 75,
    "strategy": "fit"
}