# 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="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2Fh29oAEe47OYp0sUCajz8%2Fperson.jpeg?alt=media&#x26;token=34678ca8-b98c-4124-969c-483e21ba7060" alt=""></td><td align="center"><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FVuyEZ5Mf6HED9ZfGAlfK%2Fcutout-subject.png?alt=media&#x26;token=04df9eac-25f0-40f3-b39c-ff0a8dd4bd6a" 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="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2Fh29oAEe47OYp0sUCajz8%2Fperson.jpeg?alt=media&#x26;token=34678ca8-b98c-4124-969c-483e21ba7060" alt=""></td><td align="center"><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FTcyRhITNgfuvGcdVin6r%2Fmask.png?alt=media&#x26;token=e845a669-4b26-489b-9e01-d0b663df81dc" 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="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FQTmsUrZmctQ80BRmekNn%2Fwith-matting.png?alt=media&#x26;token=4b5666ff-38de-4c77-b953-d635903ba0fe" alt=""></td><td align="center"><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FFQK3HikPnz28q3mDG0US%2Fwithout-matting.png?alt=media&#x26;token=c1268068-7ed1-4575-aa12-14497f996782" 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 %}
