Resize Image
Resizes an image to create a thumbnail.
IMG Processing allows you to apply resize your images. This is useful for scaling images to fit a specific size, or for creating thumbnails.
In this guide, we’ll see how to resize an image using the API.
Uploading our Image
The first step is to create our image we want to resize. For this, we’ll use the upload
endpoint.
Upload an Image
Upload an image to the API
First, download the image you want to resize. Here we’ll use the IMG Processing logo.
Then, copy your api key on the dashboard and replace it on the x-api-key
field, and replace the image
field with the path to the image you want to use as a watermark.
This will return an image object with the resize-logo image.
Now, we have our image created, we can resize it.
Resizing the Image
To create a thumbail we would like to resize the image to 200x200 pixels. For this, we’ll use the resize
endpoint.
Resize Image
Resize an image
As parameters, we need to send the image id of the image to resize.
As body, we need to send the target width and height of the image and the fit mode.
Here is an example request:
This will return an image object of the resized image.
Downloading the Image
Now, we have our image with the resized image, we can download it using the download
endpoint.
Download an Image
Download an image
This will download the image to your computer.
Try it yourself
You can try this on the Postman collection.
Postman Collection
Try it yourself on the Postman Collection
Keep Learning
Now that you know how to resize an image, you can learn how to do other things with the API.
- Explore the fit modes to resize the image to a specific size.