Skip to content

Image-based targeting: click wherever a captured image appears #87

Closed

Description

@TMHSDigital

Why it matters

Fixed coordinates break as soon as a window moves, a dialog appears in a different place, or the user runs on another monitor layout. Clicking "wherever this button image appears" makes routines robust and moves the app toward light, legitimate desktop automation (testing, data entry, repetitive office tasks), a much larger audience than click-speed users.

Rationale

  • PyScreeze, already a locked dependency through PyAutoGUI, provides locateOnScreen / locateCenterOnScreen (faster and with a confidence threshold when OpenCV is installed).
  • The picker can capture a reference image by dragging a rectangle.
  • The pixel condition (Conditional clicking: only click while a pixel matches a color #80) already established the pattern: screen reads happen off the click thread, and "not found" can mean wait or stop.

Suggested approach

  1. New target mode "Image": capture a template with a drag-select overlay; store it as PNG next to settings, referenced from profiles.
  2. A watcher thread searches the screen (or a chosen region) at a modest rate; the click loop clicks the latest match centre, or waits/stops when there is none.
  3. Settings: confidence (if OpenCV is available), search region, offset from the image centre.
  4. Measure the cost and document it in docs/PERFORMANCE.md; keep it optional so the base exe size doesn't grow unless OpenCV is bundled deliberately.
  5. Same safety rules as everything else: all stop paths, limits and the runaway guard apply.

Done when

  • A user can capture a button image, move the window around, and the run keeps clicking the button wherever it is, waiting when it's hidden.

Activity

  1. added
    enhancement
    priority: low
    feature
    on Oct 5, 2026
  2. TMHSDigital commented on Oct 5, 2026

    @TMHSDigital
    OwnerAuthor

    Needs a decision before implementation: fast enough image search needs OpenCV (or at least NumPy). PyScreeze's pure-Python fallback takes seconds per search on a 1080p screen, too slow for a click loop, and bundling OpenCV adds tens of MB to the single exe. Options: (a) bundle opencv-python-headless and accept the larger download, (b) make image targeting an optional feature for source/pipx installs only, (c) do a narrower version that searches only a small user-chosen region with pure Pillow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfeaturepriority: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions