Skip to main content
ImageMask(width=-1, height=-1, polygons=[], url=None, style=None)

Example

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

NameTypeDescription
widthintDisplay width in pixels. Use -1 for automatic sizing. Default: -1.
heightintDisplay height in pixels. Use -1 for automatic sizing. Default: -1.
polygonslistInitial polygon data. Each polygon is an object with polygons (list of {x, y} points in normalized 0-1 coordinates) and labels (list of strings).
urlstringURL of the image to annotate.
stylestringJSON string defining annotation colors: point_color, line_color, and surface_color.