# Download the segmentation mask

By default, the Remove Background API will return the subject that's been cutout from the input image:

<table data-header-hidden data-full-width="false"><thead><tr><th align="center"></th><th align="center"></th></tr></thead><tbody><tr><td align="center"><img src="/files/AeEOkRHfwDhclL5NsB2e" alt=""></td><td align="center"><img src="/files/wZLR2Jtv4LZXqtaI7uKO" alt=""></td></tr><tr><td align="center"><em>Input Image</em></td><td align="center"><em>Result of the API call</em></td></tr></tbody></table>

However, it's also possible for the Remove Background API to return the segmentation mask instead.

For this, you'll need to set the argument `channels` with the value `alpha`.

Here's the result it will produce:

<table data-header-hidden data-full-width="false"><thead><tr><th align="center"></th><th align="center"></th></tr></thead><tbody><tr><td align="center"><img src="/files/AeEOkRHfwDhclL5NsB2e" alt=""></td><td align="center"><img src="/files/J0AThEYhvJhw2Sq7mHMb" alt=""></td></tr><tr><td align="center"><em>Input Image</em></td><td align="center"><em>Result of the API call</em></td></tr></tbody></table>

{% hint style="info" %}
Because the mask is only in grayscale, in most cases it will be faster to download than the cutout subject.
{% endhint %}

However, there's one important caveat to be aware of:

* When returning the cutout subject, the Remove Background API will apply some matting to improve the edges of the subject.
* When returning the segmentation mask, this matting process will not be applied. So when the mask is applied manually, the edges of the cutout subject will be less precise.

Here's an example of what it looks like:

<table data-header-hidden data-full-width="false"><thead><tr><th align="center"></th><th align="center"></th></tr></thead><tbody><tr><td align="center"><img src="/files/caA80q6HwYHh7a1neZvR" alt=""></td><td align="center"><img src="/files/g8HByhtlF3lmT4XmmVrG" alt=""></td></tr><tr><td align="center"><em>With matting applied by the API</em></td><td align="center"><em>Without matting applied by the API</em></td></tr></tbody></table>

If you want to give it a try, here's a code example that's configured to download the mask:

{% code overflow="wrap" %}

```bash
curl --request POST \
  --url https://sdk.photoroom.com/v1/segment \
  --header 'x-api-key: YOUR_API_KEY' \
  --form image_file=@/absolute/path/to/image.jpg \
  --form channels=alpha \
  --output segmentation-mask.png
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.photoroom.com/remove-background-api-basic-plan/download-the-segmentation-mask.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
