> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mainly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# ImageMask

> An annotation control for drawing polygon regions on images.

```
ImageMask(width=-1, height=-1, polygons=[], url=None, style=None)
```

# Example

```python theme={null}
from mirmod.controls import ImageMask
import json

style = json.dumps({
  "point_color": "#f01010",
  "line_color": "#e21010",
  "surface_color": "#ff000033"
})

@wob.receiver("value", "mask", control=ImageMask(style=style), hidden=True, connectable=False)
def receive_mask(self, value):
  self.mask_data = value
```

# Parameters

| Name     | Type   | Description                                                                                                                                             |
| -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| width    | int    | Display width in pixels. Use -1 for automatic sizing. Default: -1.                                                                                      |
| height   | int    | Display height in pixels. Use -1 for automatic sizing. Default: -1.                                                                                     |
| polygons | list   | Initial polygon data. Each polygon is an object with `polygons` (list of `{x, y}` points in normalized 0-1 coordinates) and `labels` (list of strings). |
| url      | string | URL of the image to annotate.                                                                                                                           |
| style    | string | JSON string defining annotation colors: `point_color`, `line_color`, and `surface_color`.                                                               |
