_odiff

_odiff(tmp_dir: Path, base: str | Path | Image, comparing: str | Path | Image, diff: str | Path | None = None, *, antialiasing: bool = False, diff_color: str = '#FF0000', diff_mask: bool = False, fail_on_layout: bool = False, ignore: list[IgnoreArea | tuple[int, int, int, int]] | None = None, output_diff_lines: bool = False, reduce_ram_usage: bool = False, threshold: float = 0.1) DiffResult[source]

Run odiff in a temp directory.

Parameters:
  • tmp_dir (Path) – Temp dir to run odiff in.

  • base (str | Path | Image.Image) – Base image.

  • comparing (str | Path | Image.Image) – Comparing image.

  • diff (str | Path | None) – _description_. Defaults to None

  • antialiasing (bool) – With this flag enabled, antialiased pixels are not counted to the diff of an image. Defaults to False

  • diff_color (str) – Color used to highlight different pixels in the output (in hex format e.g. #cd2cc9). Defaults to “#FF0000”

  • diff_mask (bool) – Output only changed pixel over transparent background. Defaults to False

  • fail_on_layout (bool) – Do not compare images and produce output if images layout is different. Defaults to False

  • ignore (list[IgnoreArea | tuple[int, int, int, int]] | None) – An array of regions to ignore in the diff. Defaults to None

  • output_diff_lines (bool) – With this flag enabled, output result in case of different images will output lines for all the different pixels. Defaults to False

  • reduce_ram_usage (bool) – With this flag enabled odiff will use less memory, but will be slower in some cases. Defaults to False

  • threshold (float) – Color difference threshold (from 0 to 1). Less more precise. Defaults to 0.1

Return type:

DiffResult

Raises:

RuntimeError – If odiff throws an unexpected error.