Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find image on screen - image snapshot provided doesn't match screen #896

Closed
tlm2c09 opened this issue Dec 23, 2020 · 10 comments
Closed
Labels

Comments

@tlm2c09
Copy link

tlm2c09 commented Dec 23, 2020

Hi Ken,
Firstly, I want to thank you for developing this useful tool. It is simple and easy to begin with.

I am working with TagUI integrating with Sikuli on my Mac 2014 to click on some images. I tried to click on the outlook icon in the dock but it showed the message 'ERROR - cannot find /Users/tuongle/PycharmProjects/tag_ui_python/src/test/lib/outlook.png on screen'
I already put the .tag file and the .png files into the same folder but still no luck.
Also I tried with the absolute path to the image but the same error displays.
Screen Shot 2020-12-23 at 07 19 56
Screen Shot 2020-12-23 at 07 19 34
Could you please help me on this?
Thank you

@kensoh
Copy link
Member

kensoh commented Dec 23, 2020

Hi Tim, thanks for your appreciation. From your screenshot, it looks like the outlook icon looks different from what is in the dock. The dock has some red numbers showing number of emails but not your image snapshot. In order to find a match, the given image must match the target UI element closely.

Can you try doing [cmd][shift]4 to capture an image of the outlook icon on the dock, but you capture without including the red circle and number? If you have an image editor, you can also clip away the red number part and make it transparent. That can also be used as a match as transparent parts of a .png file will be ignored during matching.

Let me know how that goes!

@kensoh kensoh changed the title Cannot find image on screen Cannot find image on screen - image snapshot given doesn't match screen Dec 23, 2020
@kensoh kensoh added the query label Dec 23, 2020
@kensoh kensoh changed the title Cannot find image on screen - image snapshot given doesn't match screen Cannot find image on screen - image snapshot provided doesn't match screen Dec 23, 2020
@tlm2c09
Copy link
Author

tlm2c09 commented Dec 23, 2020

Hi Ken,

After I cleared all the red numbers on the outlook icon (as in the screenshot below), it still showed the error message that 'cannot find image on screen'.
I also tried with other images as well but no luck. Below are others I tried with:

Screen Shot 2020-12-24 at 06 35 55

Screen Shot 2020-12-24 at 06 37 53

Screen Shot 2020-12-24 at 06 41 35

@tlm2c09
Copy link
Author

tlm2c09 commented Dec 24, 2020

In addition, when I opened Sikuli, took screenshots and run, clicking on images worked.
And when I tried to insert the images I used with tagUI, the Sikuli could not work on clicking on images too.

@kensoh
Copy link
Member

kensoh commented Dec 24, 2020

I'm guessing could it be due to MacBook Pro Retina display? I have encountered users having problems when using the screenshot capture. If it is retina display, the image captured will be at much higher resolution than it actually is and won't match. Can you see if the solutions / workarounds at below issue works for you?

tebelorg/RPA-Python#170 (comment)

@tlm2c09
Copy link
Author

tlm2c09 commented Jan 4, 2021

I'm guessing could it be due to MacBook Pro Retina display? I have encountered users having problems when using the screenshot capture. If it is retina display, the image captured will be at much higher resolution than it actually is and won't match. Can you see if the solutions / workarounds at below issue works for you?

tebelorg/RPA-Python#170 (comment)

@kensoh thank you very much. After changing the PPI from 144 to 72, it worked for me now.

@tlm2c09 tlm2c09 closed this as completed Jan 4, 2021
@kensoh
Copy link
Member

kensoh commented Jan 4, 2021

Thanks @tlm2c09! In future when I learn of better solution I'll implement it into the tool. Have fun!

@marcelocecin
Copy link

for me the solution to reduce the PPI to 72 did not work

@kensoh
Copy link
Member

kensoh commented Mar 17, 2021

Hi Marcelo, I think somehow I missed your message. Can you tell me more if this is working now?

@marcelocecin
Copy link

hi Ken, sorry for the delay
I believe that there was an error related to the background of the image and not to the resolution
the problem was solved, thank you

@kensoh
Copy link
Member

kensoh commented Apr 23, 2021

Hi Marcelo, I see.. ok got it! For background, some image editing tool can let you select and remove background to become transparent. That way it can make an icon work better when the background colour changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants