Rescale an image to a specific width and height. The image will be resized to fit the specified width and height while maintaining the original aspect ratio unless the crop parameter is set to true. The image will be returned in the same format as the original image.
| Name | Example | Description |
|---|---|---|
url | https://fastly.picsum.photos/id/63/5000/2813.jpg?hmac=HvaeSK6WT-G9bYF_CyB2m1ARQirL8UMnygdU9W6PDvM ![]() | The url of the image to be rescaled. |
width | 200 | The desired width of the rescaled image. |
height | 200 | The desired height of the rescaled image. |
crop | true | Whether the image should be cropped. If true, the returned image will have exactly the given width and height and some content might have been cropped from the left/right or top/bottom. If this parameter is false, the image will keep its ratio but will be resized to fill the given box. Some content might be outside the box though. |
api-key | abcd1234 | Your API key. |
Response Headers:
Content-Type: application/octet-streamX-API-Quota-Request: The number of tokens used by the requestX-API-Quota-Used: The number of tokens used in total todayX-API-Quota-Left: The number of tokens left today (depends on your plan)Yes, if you set the `crop` parameter to true, the API will crop the image to fit the exact dimensions you specify, rather than just resizing it.
By default, the API maintains the aspect ratio to prevent distortion. If you enable cropping, the aspect ratio will change to match your specified width and height.
The API supports common web image formats like JPEG, PNG, and GIF.
The Rescale Image API resizes and crops images while maintaining their visual format, whereas the Image to Ascii Art API converts the image into a text-based representation.