> For the complete documentation index, see [llms.txt](https://docs.viesus.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.viesus.com/configuration/parameter-reference/background-and-cropping.md).

# Background & Cropping

## Background Handling (`Background`)

Background replacement, color substitution, and balance.

<table><thead><tr><th width="125.5999755859375">Parameter</th><th width="91.800048828125">Value</th><th width="95.7999267578125">Default</th><th>Description</th></tr></thead><tbody><tr><td><code>ReplacePath</code></td><td>String</td><td>—</td><td>Path to a <a href="/pages/GqKSz0mDGOrFA8yfHtYa">replacement background image</a></td></tr><tr><td><code>backgroundR</code></td><td>0 – 255</td><td>255</td><td><a href="/pages/GqKSz0mDGOrFA8yfHtYa">Red component</a> for background color replacement</td></tr><tr><td><code>backgroundG</code></td><td>0 – 255</td><td>255</td><td><a href="/pages/GqKSz0mDGOrFA8yfHtYa">Green component</a> for background color replacement</td></tr><tr><td><code>backgroundB</code></td><td>0 – 255</td><td>255</td><td><a href="/pages/GqKSz0mDGOrFA8yfHtYa">Blue component</a> for background color replacement</td></tr><tr><td><code>balanceH</code></td><td>-1.0 – 1.0</td><td>0.0</td><td><a href="/pages/GqKSz0mDGOrFA8yfHtYa">Hue balance</a> adjustment for background</td></tr><tr><td><code>balanceS</code></td><td>-1.0 – 1.0</td><td>0.0</td><td><a href="/pages/GqKSz0mDGOrFA8yfHtYa">Saturation balance</a> adjustment for background</td></tr><tr><td><code>balanceV</code></td><td>-1.0 – 1.0</td><td>0.0</td><td><a href="/pages/GqKSz0mDGOrFA8yfHtYa">Value balance</a> adjustment for background</td></tr></tbody></table>

***

## Portrait Auto-Cropping (`AutoCrop`)

Automatic cropping based on facial detection. See [Key Features → Adaptive Auto-Cropping](/discover/key-features.md#adaptive-auto-cropping).

<table><thead><tr><th width="219.2000732421875">Parameter</th><th width="82.2000732421875">Value</th><th width="95">Default</th><th>Description</th></tr></thead><tbody><tr><td><code>HeadYawCoeff</code></td><td>Float</td><td>0.67</td><td>Coefficient for head yaw adjustment</td></tr><tr><td><code>HeadPitchCoeff</code></td><td>Float</td><td>0.75</td><td>Coefficient for head pitch adjustment</td></tr><tr><td><code>HeadroomFixed</code></td><td>0, 1</td><td>1</td><td>Use fixed headroom calculation</td></tr><tr><td><code>HeadroomUnit</code></td><td>Integer</td><td>0</td><td>Headroom unit type</td></tr><tr><td><code>ImageToHeadRatio</code></td><td>Float</td><td>0.48</td><td>Ratio of image to head size</td></tr><tr><td><code>HeadroomLeft</code></td><td>Float</td><td>0.1</td><td><a href="/pages/lrYFJ4WmOD1ehGaHxCLZ">Left side headroom</a></td></tr><tr><td><code>Headroom</code></td><td>Float</td><td>0.1</td><td><a href="/pages/lrYFJ4WmOD1ehGaHxCLZ">General headroom</a></td></tr><tr><td><code>CropModeHeadroom</code></td><td>Float</td><td>0.0</td><td><a href="/pages/lrYFJ4WmOD1ehGaHxCLZ">Headroom for crop mode</a></td></tr><tr><td><code>AspectHeight</code></td><td>Float</td><td>1.0</td><td>Target <a href="/pages/lrYFJ4WmOD1ehGaHxCLZ">aspect ratio height</a></td></tr><tr><td><code>AspectWidth</code></td><td>Float</td><td>1.0</td><td>Target <a href="/pages/lrYFJ4WmOD1ehGaHxCLZ">aspect ratio width</a></td></tr><tr><td><code>PortraitMode</code></td><td>Integer</td><td>2</td><td><a href="/pages/lrYFJ4WmOD1ehGaHxCLZ">Portrait cropping mode</a></td></tr><tr><td><code>AdaptAspectRatioToFace</code></td><td>0, 1</td><td>1</td><td>Adapt aspect ratio based on face detection</td></tr><tr><td><code>AspectRatio</code></td><td>Integer</td><td>0</td><td>Fixed aspect ratio mode</td></tr><tr><td><code>CropMode</code></td><td>0 – 2</td><td>0</td><td><a href="/pages/lrYFJ4WmOD1ehGaHxCLZ">Cropping mode</a> (see <a href="#cropmode-values">CropMode values</a> below)</td></tr></tbody></table>

### `CropMode` values

<table><thead><tr><th width="118">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>0</code></td><td>Manual — uses the configured aspect ratio and headroom values without face-based adjustment</td></tr><tr><td><code>1</code></td><td>Automatic — crops to the dominant detected face using the configured aspect ratio and headroom</td></tr><tr><td><code>2</code></td><td>Group — crops to include all detected faces (for group portraits)</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.viesus.com/configuration/parameter-reference/background-and-cropping.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
