Skip to content

testudos.internal.helpers.images

testudos.internal.helpers.images

Image capture and comparison helpers.

require_pillow

def require_pillow()

Import and return (Image, ImageChops, ImageStat) from Pillow, or raise ImportError.

images_equal

def images_equal(actual, baseline, tolerance: float) -> bool

Compare two Pillow RGB images. Returns True if they match within tolerance.

Arguments:

  • actual - Pillow Image (RGB).
  • baseline - Pillow Image (RGB).
  • tolerance - Maximum allowed mean pixel difference per channel (0–255 scale). 0.0 means pixel-perfect match required.

captured_image_from_engine

def captured_image_from_engine(*, item_object_id: str | None) -> CapturedImage

Call capture_screen or capture_item and wrap the result as CapturedImage.

Raises:

  • TestudosError - If RPC result indicates a null image.

compare_pillow_to_file

def compare_pillow_to_file(image: CapturedImage,
baseline_path: str,
tolerance: float = 0.0) -> bool

Compare a captured image with an on-disk baseline PNG.