ImageSearch Scaling

Get help with using AutoHotkey and its commands and hotkeys
Trigg
Posts: 97
Joined: 07 Apr 2017, 19:43

ImageSearch Scaling

01 Oct 2017, 11:46

Good afternoon guys!

I have been trying to figure this out for months. For some reason images change color depending on resolution. I've tested a loop to try and find the image based on shades and/or scale size, but it loops for so long that it eventually finds an inaccurate object.

I am using an image which was screenshotted with 1920x1080p monitor. I have no luck finding the image after switching monitors to a lower resolution (1600x900), and I noticed that screenshotting the same image on both monitors changes multiple hues, saturiations, lum, and color shades.

Any help is appreciated :)!

Code: Select all

ImageSearch, Px, Py, 0, 0, A_ScreenWidth, A_ScreenHeight, Test1.png
If ErrorLevel
	Function()

Function()
{
CoordMode, Screen
	range = 240
	scale = 1
	shade = 1
	Loop, %range%
		{
		shade += 1
		scale += 1
		; Searches for the image at incremetnal width %scale% with preserved aspect ration "h-1"
		ImageSearch, Px, Py, 0, 0, A_ScreenWidth, A_ScreenHeight, *%shade% Test1.png
		If !ErrorLevel
			{
			MouseMove, Px, Py
			Break
			}
		Else
			{
			ImageSearch, Px, Py, 0, 0, A_ScreenWidth, A_ScreenHeight, *w%scale% *h-1 Test1.png
			If !ErrorLevel
				{
				MouseMove, Px, Py
				Break
				}
			Else
				{
				ImageSearch, Px, Py, 0, 0, A_ScreenWidth, A_ScreenHeight, *%shade% *w%scale% *h-1 Test1.png
				If !ErrorLevel
					{
					MouseMove, Px, Py
					Break
					}
				}
			}
		}
}
KeypressGuy
Posts: 16
Joined: 17 Jul 2017, 16:55

Re: ImageSearch Scaling

02 Oct 2017, 12:06

Ran into the same problem. I find I have to set all my monitors to the same scaling (I run at 100% instead of what many use as a default, 125%) and also have to disable color management for each monitor that uses color management. - or for each browser. For instance, in Chrome, the setting is in chrome://flags: Color correct rendering

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], Jovannb, Lecso0522, mikeyww, Rikk03 and 52 guests