Rescale Image API

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.

GET
https://api.apileague.com/rescale-image

Parameters

NameExampleDescription
url
s r q
https://fastly.picsum.photos/id/63/5000/2813.jpg?hmac=HvaeSK6WT-G9bYF_CyB2m1ARQirL8UMnygdU9W6PDvM The url of the image to be rescaled.
width
n r q
200The desired width of the rescaled image.
height
n r q
200The desired height of the rescaled image.
crop
b r q
trueWhether 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
s r q
abcd1234Your API key.
Example Request and Response
GET
https://api.apileague.com/rescale-image?width=30&height=30&crop=false&url=https%3A%2F%2Ffastly.picsum.photos%2Fid%2F63%2F5000%2F2813.jpg%3Fhmac%3DHvaeSK6WT-G9bYF_CyB2m1ARQirL8UMnygdU9W6PDvM
Rescale Image API

Headers

Response Headers:

  • Content-Type: application/octet-stream
  • X-API-Quota-Request: The number of tokens used by the request
  • X-API-Quota-Used: The number of tokens used in total today
  • X-API-Quota-Left: The number of tokens left today (depends on your plan)

Frequently Asked Questions

Does it support cropping?

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.

What happens to the aspect ratio?

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.

What image formats are supported?

The API supports common web image formats like JPEG, PNG, and GIF.

How is the Rescale Image API different from the Image to Ascii Art API?

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.

Questions? Need Help? Ask Away

Quotas

Calling this endpoint costs
2 tokens