Home Assistant Unofficial Reference 2024.12.1
homeassistant.util.pil Namespace Reference

Functions

None draw_box (ImageDraw draw, tuple[float, float, float, float] box, int img_width, int img_height, str text="", tuple[int, int, int] color=(255, 255, 0))
 

Detailed Description

PIL utilities.

Can only be used by integrations that have pillow in their requirements.

Function Documentation

◆ draw_box()

None homeassistant.util.pil.draw_box ( ImageDraw  draw,
tuple[float, float, float, float]  box,
int  img_width,
int  img_height,
str   text = "",
tuple[int, int, int]   color = (255, 255, 0) 
)
Draw a bounding box on and image.

The bounding box is defined by the tuple (y_min, x_min, y_max, x_max)
where the coordinates are floats in the range [0.0, 1.0] and
relative to the width and height of the image.

For example, if an image is 100 x 200 pixels (height x width) and the bounding
box is `(0.1, 0.2, 0.5, 0.9)`, the upper-left and bottom-right coordinates of
the bounding box will be `(40, 10)` to `(180, 50)` (in (x,y) coordinates).

Definition at line 11 of file pil.py.