4K Resolution 150% Zoom

Asked by Tomas Vohradnik

Hi RaiMan,

I was trying to find a solution and went through all the questions here and on StackOverFlow regarding the problems with 4K resolution or to be more specific problem with sikuli when the resolution is high and windows set the scale from default 100% to 150%.

I was thinking how about adding any kind of settings file where you could use variable scale and set that value to any number that user needs and then it would do the calculations where to click?

Cuz at the moment it clicks OK on 4K resolution when the Windows scale (Windows > Display > Scale and Layout) is set to 100% but it stops working when the scale is set to 150% which is recommended when using high resolution..

And frankly, 4K 100% scale is really too small to read..

Thank you for considering this suggestion of fixing it and your answer in advance!

Tomas

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Tomas Vohradnik
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Already tried with Java 11 or 17?

Revision history for this message
Tomas Vohradnik (vohratom) said :
#2

Well I tried that with Java 11 and thanks for your prompt reply

Revision history for this message
RaiMan (raimund-hocke) said :
#3

just checked on Win11 (should be the same as in Win10) with Java 11:

images taken with a specific monitor setting are found, if at time of scriptrun the monitor settings are identical.

so if you run with 150% it should work if you do everything with this setting.

With 2.0.5 there is a problem with multimonitor, if one of them is 4K.

If this is your case, then make the 4K the primary and try again.

The latter problem will be fixed in the next version.

For the case, that you have taken images in a special setup and then run in another scaled setup, there is Pattern.resize() and Settings.AlwaysResize to adjust the images.

Revision history for this message
Tomas Vohradnik (vohratom) said :
#4

Hi RaiMan,

thank you for the detailed explanation and suggestions on how to fix it.

Let me describe the situation:

SETUP:
I have two monitors:
 1. Monitor, 4k, set to resolution 3840x2160, scale 150%, Set as Primary
 2. Monitor, Full HD, set to resolution 1920x1080, scale 100%

 Running Sikuli version 2.0.5.

SIKULI IS WORKING FINE:
 Resolution: 3840x2160
 Scale: 100%

 Screenshot of the folder shown on the desktop of my primary monitor taken via Snipping Tools.

 Clicking OK when running the script.

 However when I set the scale of the windows from 100% to 150% which is recommended, then the image is not found on the screen. Nothing else was changed.
 When I change it back to a 100% scale it's working fine again.

SIKULI IS NOT WORKING:
 Resolution: 3840x2160
 Scale: 150%

 Screenshot of the folder shown on the desktop of my primary monitor taken via Snipping Tools.

 NOT clicking when running the script.

 BUT, when I leave the Snipping Tools window with the screenshot of the folder opened on my Primary monitor, it clicks to that image..

And then the last funny part is that when I take a screenshot on my Full HD monitor (100% scale) and run the script on my 4K monitor, it clicks to the image..

I was thinking whether the problem could not be in Snipping Tools but I tried another program and also to take a screenshot via Print Screen but still once the Scaling is anything else than 100% it stops working..

I also tried to disable the second monitor just to verify it's not caused by the known issues you mentioned..

Any ideas on how to make it work with a 150% or 125% scale? :-)

I upgraded Windows from 10 to 11 but it did not help..

Thank you!

Tomas

Revision history for this message
Tomas Vohradnik (vohratom) said :
#5

Hi RaiMan,

sorry to bother you, but do we have any update on this one, please?

Thanks!

T

Revision history for this message
RaiMan (raimund-hocke) said :
#6

Sorry for the delay: private prios.

I have no general solution for you based on 2.0.5
I will check the situation in 2.0.6 and probably add some enhancements.

Recommendation (for now):
- have a set of shots for each resolution to be used (ImagePath)
- use the SikuliX IDE to create the shot images
- switch the bundle path to the corresponding image folder when running the script

The intended functionality is to have one set of shots and resize the images to the actual resolution at script runtime, either by a setting value or automatically (based on the first image used).

Revision history for this message
Tomas Vohradnik (vohratom) said :
#7

Hi RaiMan,

no problem at all!

Well, the thing is that once I am gonna take a screenshot when the windows scale is set to anything else except 100% then sikuli cannot find the image.

So the only way how to make it work is to take the screenshot when the scale is set to 100% and then set the scale to 125% then sikuli sometimes finds the image and sometimes it does not so I was thinking if the next version could have some kind of feature that once you take an image when the scale is 100% then try to find that image in all the variety of scale settings so 125, 150, 175, 200, ...

Btw I tried SikuliX IDE but it's the same as with Snipping Tools.

Anyways thank you very much for all your hints and help, much appreciated!

Tomas

Revision history for this message
RaiMan (raimund-hocke) said :
#8

OK, please confirm, that the following is NOT working:

- set the scale to 125%
- start the SikuliX IDE

- create a new script:
img = <do a snapshot with cursor here>
find(img)

- run the script

- you get a FindFailed exception (image not found)

BE aware:
If you change the scale factor, while SikuliX IDE is running, then you have to restart the IDE to make it aware of the new setting.

Revision history for this message
Tomas Vohradnik (vohratom) said :
#9

Confirmed.

What I did step by step - NOT WORKING
1. Set Windows to 125%
2. Launched Sikulix IDE
3. Took a screenshot saved it
4. Created a 1 step script that should click to the image I took with Sikulix IDE
5. Script failed to find the image on the screen

What I did step by step - WORKING
1. Set Windows to 100%
2. Launched Sikulix IDE
3. Took a screenshot saved it
4. Created a 1 step script that should click to the image I took with Sikulix IDE
5. Script found the image on the screen

Revision history for this message
RaiMan (raimund-hocke) said :
#10

ok, thanks for the confirmation.

Then it seems to be a problem with the 4K monitor settings and the internal handling by Java 11+.
(the screenshot feature is a basic Java AWT Robot feature).

The first case in my non-4K setup simply works.

I cannot dig deeper, since I do not have a 4K monitor available in the Windows environment. But it would help a bit, if you send me the 100%-image and the 125%-image to my mail sikulix---at---outlook---dot---com.

I will test now in my Mac environment, where I have Retina displays available.

Revision history for this message
Tomas Vohradnik (vohratom) said :
#11

no probs :-)

btw it's not 4K monitor related - I just tried that on my FullHD monitor:

Win11 > Scale 125% > took a screenshot with SikuliX Ide (opened after the scaling was changed) > script did not find the image

did the same when the scale is set to 100% and everything works smoothly..

The only setting done in the config file is:
Settings.MinSimilarity = 0.8;

Revision history for this message
RaiMan (raimund-hocke) said :
#12

ok, thanks.

Could you try with only the Full-HD Monitor active? (this is my configuration).

Until tomorrow I will publish a new build of the 2.0.6 snapshot version.
A test the next days with that version would be helpful.

Revision history for this message
Tomas Vohradnik (vohratom) said :
#13

Hi RaiMan,

I was about to take a screenshot for you on my 4K monitor with different scaling and when I changed the scaling and launched SikuliX IDE I noticed the message SikuliX is starting on Java 8... so I changed it to Java 11 and everything started working smoothly even when scaling is not 100%..

I would like to apologize to you for not noticing that before :-(

However one useful note for the others:
It is working on different scaling only when you take a screenshot via SikuliX IDE and it is NOT working when the image is taken via Snipping Tools!

Hope this thread will help the others!

and RaiMan once again big thank you for your support!

Revision history for this message
RaiMan (raimund-hocke) said :
#14

LOL, due to your systematic approach I did not dare to ask, wether you are sure to run a Java 11+. Ok should have done it earlier again.

Though no problem.
All the best.

Revision history for this message
Tomas Vohradnik (vohratom) said :
#15

Yeah, my fault, sorry about that once again RaiMan!

Feel kinda stupid ngl :D

Tomas