Skip to content

Screen scaling factor (Screen Scaling on Windows / Retina Display on Mac) #62

@damies13

Description

@damies13

Well this is frustrating,

I was trying to set up some basic tests for issues #60 and #61 before I start making changes and I encountered the "retina display issue" when trying to use Click Image.

Did a little research, and found that the upstream pyautogui is the cause, there is a known issue for this #589 where a workaround is provided so they closed the issue, so it looks like if we want IHL to behave as users would expect then we need to handle it by implementing the workaround.

I also found this issue impacts Windows machines when screen scaling is enabled, while on Mac's the Retina display means the co-ordinates are always double (200%) what they need to be, with windows the scaling factor can vary between 100% and 500% times with typical values being 125%, 150%, 175%, 200%

Fortunately the workaround provided pixelRatio = pyautogui.screenshot().size[0]/pyautogui.size().width does give us the ratio, so it's a simple matter of dividing the x and y values from pyautogui by the pixelRatio and returning the new co-ordinates.

Also fortunately the workaround doesn't need any additional python modules so it's a minimal impact.

I will submit a fix for this issue soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions