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.

curl -X POST "https://api.img-processing.com/v1/images" \
     -H "x-api-key: YOUR_API_KEY" \
     -F "image=@logo.png" \
     -F "name=resize-logo"

This will return an image object with the resize-logo image.

{
    "id":"image_za9vcdw6yajjyg77v5kkf3bn",
    "name":"resize-logo",
    "url":null,
    "width":1515,
    "height":1505,
    "format":"png",
    "size":1939304,
    "created_at":"2025-04-01T16:52:32.503Z"
}

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.

https://api.img-processing.com/v1/images/{imageId}/resize

As body, we need to send the target width and height of the image and the fit mode.

{
    "width": 200,
    "height": 200,
    "fit": "contain"
}

Here is an example request:

curl -X POST "https://api.img-processing.com/v1/images/image_za9vcdw6yajjyg77v5kkf3bn/resize" \
     -H "x-api-key: YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
        "width": 200,
        "height": 200,
        "fit": "contain"
    }'

This will return an image object of the resized image.

{
    "id":"image_idl1ad5ppzbq65qohwbtcdjc",
    "name":"cat-image",
    "url":null,
    "width":200,
    "height":200,
    "format":"png",
    "size":63634,
    "created_at":"2025-04-01T17:02:58.496Z"
}

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

curl -X GET "https://api.img-processing.com/v1/images/YOUR_IMAGE_ID/download" \
     -H "x-api-key: YOUR_API_KEY" \
     -o "resized-image.png"

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.