ImageSearch vs Night light & f.lux

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
K201902
Posts: 29
Joined: 23 Feb 2019, 11:31

ImageSearch vs Night light & f.lux

Post by K201902 » 25 Jul 2022, 13:33

Hi!
ImageSearch is a very cool command to search for buttons on the screen that match an image (for example). I've found the limits of this function though when the monitor uses the likes of f.lux or Night light (Windows tool) to turn the screen more yellow (e.g. at night time). When the screen tint changes, ImageSearch fails to find the button. Now there is a parameter *0-255 that could work around that, but I find its results too fickle in this particular case.
I am trying to figure out a workaround, perhaps going grayscale or compare differences in pixel colors of nearby pixels, but in the meantime I was wondering if there is perhaps a known way to overcome this limitation?
Thanks in advance for any kind hint!
:-)
K
https://www.autohotkey.com/docs/commands/ImageSearch.htm
P.S. the same issue was already asked here with no reply: viewtopic.php?f=76&t=81217&p=353420&hilit=imagesearch+f.lux#p353420

iseahound
Posts: 1444
Joined: 13 Aug 2016, 21:04
Contact:

Re: ImageSearch vs Night light & f.lux

Post by iseahound » 25 Jul 2022, 15:50

It would be pretty easy, I think.

1. Save your original color.
2. Create a GUI with that color under the new conditions.
3. Get the new color.
4. Use pixelsearch / imagesearch using that new color.

I'm going to use ImagePut to demonstrate this since it's easier for me

Code: Select all

#include ImagePut.ahk
pic := ImagePutBuffer("https://picsum.photos/300/300") ; Load image
hwnd := pic.show() ; or ImageShow(pic)                 ; Show image
new_pic := ImagePutBuffer(hwnd)                        ; Save new image
;ImageDestroy(hwnd)                                     ; Close window
screen := ImagePutBuffer(0)                            ; Capture screen
if screen.ImageSearch(new_pic)
   MsgBox found!
else Reload

K201902
Posts: 29
Joined: 23 Feb 2019, 11:31

Re: ImageSearch vs Night light & f.lux

Post by K201902 » 30 Jul 2022, 12:39

Thank you, @iseahound, for your kind reply and a very interesting tip. I will try it and write about how it works for me here. It will take me some time to get to it though.
:)
K

FatCash
Posts: 3
Joined: 25 Mar 2021, 01:32

Re: ImageSearch vs Night light & f.lux

Post by FatCash » 03 Oct 2022, 09:05

Hi, I have the exact same issue with f.lux. Did you have any progress?
I guess we are looking for some script that clones the original image and applies same color filters that are used in flux. So you are matching with multiple image color variants of same image?

Post Reply

Return to “Ask for Help (v1)”