Principle:A9T9 RPA Pattern Image Loading
| Knowledge Sources | |
|---|---|
| Domains | Computer_Vision, Image_Search |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Mechanism for loading stored template images (pattern images) from extension storage with platform-specific DPI variants for cross-platform visual automation.
Description
Pattern Image Loading is the process of retrieving a template image file from the extension's vision storage so it can be matched against a screenshot. The challenge is that UI widgets are rendered by the OS, not by the browser — the same control has different corner radii, fonts, focus rings, and antialiasing on macOS, Windows, and Linux. A pattern image captured on Windows will score just under the similarity threshold on macOS (e.g. 0.55-0.59 against a 0.60 default), causing a false negative.
The solution is platform variant resolution: the loader checks for platform-specific variants of the pattern image (e.g. `tab_dpi_96.png` → `tab_mac_dpi_192.png` on macOS Retina, `tab_linux_dpi_120.png` on Linux GNOME-Wayland). Variants are tried in priority order, falling back to the base filename if no variant exists. The resolved filename also determines the effective DPI, which feeds into coordinate normalization.
Usage
Use this principle when a visual automation system must work across platforms with OS-rendered UI elements. The variant system ensures one macro works on every platform where the target looks the same, while shipping platform-specific pixels where it differs.
Theoretical Basis
Platform variant resolution is a priority-ordered fallback search:
Failed to parse (syntax error): {\displaystyle \text{resolve}(\text{fileName}) = \text{first\_existing}(\text{variants}(\text{fileName}) \cup \{\text{fileName}\}) }
Where variants are generated by platform-specific suffix insertion:
Failed to parse (unknown function "\begin{cases}"): {\displaystyle \text{variants}(\text{file}) = \begin{cases} [\text{file}_{\text{mac\_dpi\_192}}, \text{file}_{\text{mac}}] & \text{on macOS} \\ [\text{file}_{\text{linux\_dpi\_120}}, \text{file}_{\text{linux}}] & \text{on Linux (desktop)} \\ [] & \text{otherwise} \end{cases} }