> ## Documentation Index
> Fetch the complete documentation index at: https://docs.img-processing.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.

> [card] [Upload an Image](https://docs.img-processing.com/api-reference/endpoints/creation/upload.md)
>
> Upload an image to the API

First, download the image you want to resize. Here we'll use the IMG Processing logo.

![IMG Processing Logo](https://mintcdn.com/imgprocessing/96najFJQ0rXKRJFY/logo/logo.png?fit=max\&auto=format\&n=96najFJQ0rXKRJFY\&q=85\&s=1b02fc935abd127d4c9f191f6fae5a90)

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.

```bash theme={null}
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.

```json theme={null}
{
    "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.

> [card] [Resize Image](https://docs.img-processing.com/api-reference/endpoints/transformation/resize.md)
>
> 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.

```json theme={null}
{
    "width": 200,
    "height": 200,
    "fit": "contain"
}
```

Here is an example request:

```bash theme={null}
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.

```json theme={null}
{
    "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.

> [card] [Download an Image](https://docs.img-processing.com/api-reference/endpoints/download)
>
> Download an image

```bash theme={null}
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.

![Resized Image](https://mintcdn.com/imgprocessing/96najFJQ0rXKRJFY/images/examples/resized-image.png?fit=max\&auto=format\&n=96najFJQ0rXKRJFY\&q=85\&s=0712c846ca7b884c9983738192d8f381)

## Try it yourself

You can try this on the Postman collection.

> [card] [Postman Collection](https://app.getpostman.com/run-collection/6263667-a1fd2c1b-fe7b-4a05-87c1-6e0172caa20c?action=collection%2Ffork\&source=rip_markdown\&collection-url=entityId%3D6263667-a1fd2c1b-fe7b-4a05-87c1-6e0172caa20c%26entityType%3Dcollection%26workspaceId%3D845670a4-96fc-43cb-8204-4cff32ab67f2#?env%5BAPI%5D=W3sia2V5IjoiaG9zdCIsInZhbHVlIjoiaHR0cHM6Ly9hcGkuaW1nLXByb2Nlc3NpbmcuY29tIiwiZW5hYmxlZCI6dHJ1ZSwidHlwZSI6ImRlZmF1bHQiLCJzZXNzaW9uVmFsdWUiOiJodHRwczovL2Rldi1hcGkuaW1nLXByb2Nlc3NpbmcuY29tIiwic2Vzc2lvbkluZGV4IjowfSx7ImtleSI6ImFwaWtleSIsInZhbHVlIjoiIiwiZW5hYmxlZCI6dHJ1ZSwidHlwZSI6InNlY3JldCIsInNlc3Npb25WYWx1ZSI6ImxpdmVfYWo0ZXVvZjV5OTJ0YzRweGxwZjg5bDlwdWhxYXlla2IiLCJzZXNzaW9uSW5kZXgiOjF9LHsia2V5IjoiaW1hZ2VfaWQiLCJ2YWx1ZSI6IiIsImVuYWJsZWQiOnRydWUsInR5cGUiOiJhbnkiLCJzZXNzaW9uVmFsdWUiOiJpbWFnZV9qbGp0eXdmMGlodmJxcnRkMHYyNGEzd20iLCJzZXNzaW9uSW5kZXgiOjJ9XQ==)
>
> 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](https://docs.img-processing.com/api-reference/endpoints/transformation/resize.md#param-fit) to resize the image to a specific size.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.