> ## 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 title="Upload an Image" icon="upload" href="/api-reference/endpoints/creation/upload" horizontal>
  Upload an image to the API
</Card>

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

<img src="https://mintcdn.com/imgprocessing/96najFJQ0rXKRJFY/logo/logo.png?fit=max&auto=format&n=96najFJQ0rXKRJFY&q=85&s=1b02fc935abd127d4c9f191f6fae5a90" alt="IMG Processing Logo" class="rounded-lg" width="1515" height="1505" data-path="logo/logo.png" />

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 title="Resize Image" icon="compress" href="/api-reference/endpoints/transformation/resize" horizontal>
  Resize an image
</Card>

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 title="Download an Image" icon="download" href="/api-reference/endpoints/download" horizontal>
  Download an image
</Card>

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

<img src="https://mintcdn.com/imgprocessing/96najFJQ0rXKRJFY/images/examples/resized-image.png?fit=max&auto=format&n=96najFJQ0rXKRJFY&q=85&s=0712c846ca7b884c9983738192d8f381" alt="Resized Image" class="rounded-lg" width="200" height="200" data-path="images/examples/resized-image.png" />

## Try it yourself

You can try this on the Postman collection.

<Card title="Postman Collection" icon="flask" href="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==" horizontal>
  Try it yourself on the Postman Collection
</Card>

## 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](/api-reference/endpoints/transformation/resize#param-fit) to resize the image to a specific size.
