Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.camera.img_util Namespace Reference

Classes

class  TurboJPEGSingleton
 

Functions

tuple[int, int]|None find_supported_scaling_factor (int current_width, int current_height, int target_width, int target_height)
 
bytes scale_jpeg_camera_image (Image cam_image, int width, int height)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
int JPEG_QUALITY = 75
 
list SUPPORTED_SCALING_FACTORS = [(7, 8), (3, 4), (5, 8), (1, 2), (3, 8), (1, 4), (1, 8)]
 

Detailed Description

Image processing for cameras.

Function Documentation

◆ find_supported_scaling_factor()

tuple[int, int] | None homeassistant.components.camera.img_util.find_supported_scaling_factor ( int  current_width,
int  current_height,
int  target_width,
int   target_height 
)
Find a supported scaling factor to scale the image.

If there is no exact match, we use one size up to ensure
the image remains crisp.

Definition at line 27 of file img_util.py.

◆ scale_jpeg_camera_image()

bytes homeassistant.components.camera.img_util.scale_jpeg_camera_image ( Image  cam_image,
int  width,
int  height 
)
Scale a camera image.

Scale as close as possible to one of the supported scaling factors.

Definition at line 48 of file img_util.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.camera.img_util._LOGGER = logging.getLogger(__name__)
private

Definition at line 22 of file img_util.py.

◆ JPEG_QUALITY

int homeassistant.components.camera.img_util.JPEG_QUALITY = 75

Definition at line 24 of file img_util.py.

◆ SUPPORTED_SCALING_FACTORS

list homeassistant.components.camera.img_util.SUPPORTED_SCALING_FACTORS = [(7, 8), (3, 4), (5, 8), (1, 2), (3, 8), (1, 4), (1, 8)]

Definition at line 20 of file img_util.py.