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

# Remove Image Background

> Remove the background of an image

One of the main functionalities of IMG Processing is the background removal feature, being one of the best on the whole internet,
in quality and price, being x50 cheaper than tools like RemoveBG, and getting awesome results.

In this guide, we'll see how to remove the background of an image using the API.

## Creating an Image

All the images in IMG Processing, must be created. To create an image you can upload one from your computer, by an url from an allowed origin, or create one from a prompt.
Let's create an image by uploading one from your computer. We'll use the curl command to do this since it's the more generic way to do it, but you can use any other tool you want.

First, download the image you want to remove the background from. Here we'll use a cat image.

<img src="https://mintcdn.com/imgprocessing/96najFJQ0rXKRJFY/images/cat2.png?fit=max&auto=format&n=96najFJQ0rXKRJFY&q=85&s=16e40b15afa982c051d6e05b9833a2e3" alt="Cat with background" class="rounded-lg" width="1024" height="1024" data-path="images/cat2.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 remove the background from.

```bash theme={null}
curl -X POST "https://api.img-processing.com/v1/images" \
     -H "x-api-key: YOUR_API_KEY" \
     -F "image=@cat2.png" \
     -F "name=cat-image"
```

After doing it, just run send! This will return an image object in the response.

```json theme={null}
{
    "id":"image_iv7d1rish0ymrmk7qwuht3ap",
    "name":"cat-image",
    "url":null,
    "width":1024,
    "height":1024,
    "format":"png",
    "size":1427326,
    "created_at":"2025-04-01T16:15:44.212Z"
}
```

Now, we have the image created, and we can remove the background.

<Card title="Upload an Image" icon="upload" href="/api-reference/endpoints/creation/upload" horizontal>
  Upload an image to the API
</Card>

## Removing the Background

To remove the background of an image, we need to send the image id to the `remove-background` endpoint.

<Card title="Remove Background" icon="loader" href="/api-reference/endpoints/edition/remove-background" horizontal>
  Remove the background of an image
</Card>

As parameters, we need to send the image id, we got from the previous step.

```bash theme={null}
curl -X POST "https://api.img-processing.com/v1/images/YOUR_IMAGE_ID/remove-background" \
     -H "x-api-key: YOUR_API_KEY"
```

This will return a new image object with the background removed.

```json theme={null}
{
    "id":"image_rvcisofzcswx2sw3tbjjmzi5",
    "name":"cat-image",
    "url":null,
    "width":1024,
    "height":1024,
    "format":"png",
    "size":1217323,
    "created_at":"2025-04-01T16:21:49.596Z"
}
```

## Downloading the Image

Now, we have the image with the background removed, and 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>

As parameters, we need to send the image id, we got from the previous step.

```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 "cat-image-removed-background.png"
```

This will download the image to your computer.

<img src="https://mintcdn.com/imgprocessing/96najFJQ0rXKRJFY/images/cat2-removed.png?fit=max&auto=format&n=96najFJQ0rXKRJFY&q=85&s=52811e8b9d7e83f68f03a2d5b5c0f256" alt="Cat without background" class="rounded-lg" width="1024" height="1024" data-path="images/cat2-removed.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 remove the background of an image, you can learn how to do other things with the API.
