Finding image problem

I recently transferred my macros from a computer running 10.10.3 to a computer running 10.10.5 both running the newest versions of KM. On the computer with 10.10.3 finding an image worked flawlessly. But I found that when trying them on the newer machine 10.10.5 the find image functions didnt work as well.

I made some simple macros to test it by trying to find simple images simple, something like these

test image 1.
27 PM

test image 2.
This image is actually a white rectangle 2x20 pixels that wont show up if I uploaded it.

It didnt find either image at first. My general workflow for getting an image is to use preview to take the screenshot then in preview I could make a more precise selection and then copy/paste that into KM which I needed to do because I had to be pixel accurate on some occasions. I tried skipping using Preview and just got selections by using the mac shortcut command Ctrl+Shift+4 and then dragging that picture from my desktop to KM.

Image 1 is never found. However after skipping the Preview workflow image 2 is found with the "if" action but not found with the "find image action"

I read on the forums that Yosemite had some functionality issues with KM but nothing I read seemed to relate to this. I also thought I would mention this display is Retina whereas my previous computer was not.

I am not sure if this is something that can be fixed or if I should just go ahead and upgrade to High Sierra and hope for the best. I have been warned before that upgrading to that OS might not be the best to run KM at this time. So if anyone has any idea as to why this is happening or any solutions I would love to hear!

Thank you

Since I don’t have any Mac running 10.10 probably I can’t help you much. Nevertheless some general notes and tips:

test image 2.
This image is actually a white rectangle 2x20 pixels

Depending on the screen content, I imagine it can be difficult to apply a Find Image action to such a small (and white!) image.

For debugging, in the image finding action select the option “Display” (a checkbox). This gives you a visual indicator that shows you if and where the image has been found, how many instances have been found, and how much the images correspond (percentage).

And, of course, play around with the fuzziness setting. (The slider.)

My general workflow for getting an image is to use preview to take the screenshot then in preview I could make a more precise selection

Basically it doesn’t matter with which program you crop or prepare your image. Just make sure that some things do not happen:

  • Don’t scale the image.
  • Don’t save it as JPEG (JPEG removes information and creates artifacts, especially in images with hard contours). PNG is usually the best for typical screenshots of UI elements.
  • Make sure the program does not alter the colors, brightness, contrast, etc.

I also thought I would mention this display is Retina whereas my previous computer was not.

If not already done, then make new screenshots on the Retina display. Retina and non-Retina screenshots have different sizes (different amount of pixels) and this might have an influence on the recognition.

I read on the forums that Yosemite had some functionality issues with KM but nothing I read seemed to relate to this

I haven’t searched the forum for that, but the official KM page states that KM 8.2.1 is fully compatible with macOS 10.10.

or if I should just go ahead and upgrade to High Sierra and hope for the best.

Assuming that the above mentioned compatibility note on the KM page is correct, then there should be no need to upgrade.

I have been warned before that upgrading to that OS might not be the best to run KM at this time.

I have KM8 on three different Macs with High Sierra and don’t have issues (at least to my knowledge). But this may depend on the general setup of the machine, on the hardware, etc. But, as said, if it’s just for your image finding problem, and otherwise you are happy with 10.10, then there should be no need to upgrade.

Hope this helps a little bit.

1 Like

Hey Tom thanks,

So in regards to the white image its actually the one I am having the most luck with. It is found with at least the "if" function but no other functions (click at found image or find image). It's the exact same image being tried in all 3 functions and all images I am trying are taken on the retina display I am using. The seeming easy image (the one with the play/stop buttons) doesnt get found by any of the 3.

I tried different amounts of fuzzy and having display checked and nothing changes. And as far as the cropping goes I am just doing the apple screenshot shortcut command and dragging the image straight from desktop to KM so absolutely no formatting is done.

So as a test you can see that it can find these white boxes in the KM window all over the place with the 'if' function but not with the mouse click function

I dont know what happened but it now seems to be finding the image. So weird.

Great!

BTW, if you want to perform multiple actions on the same found-image condition, you don’t need to execute multiple image-finding actions.

The coordinates of the found image are available with the %FoundImage% token. With that token you can reuse the coordinates for other actions.

Example:

06-pty-fs8

Multiple Actions on One FoundImage [example].kmmacros (15.3 KB)

The macro will perform a mouse click on the center of the found image, and then you can add your other action(s) in the place where you see the comment “[Put your other action here]”.

You can reuse the variables with the coordinates (‘Local ImageLoc.Midx’ and ‘Local ImageLoc.Midy’) in the other actions.

This has at least two advantages:

  • You need to adjust the fuzziness only once
  • Finding images is expensive (resource-wise). The less image-finding actions you have in the macro, the better.
4 Likes

ooooooooooooo boy you done it now! That is a huge piece of information for me that I did not know. Thanks bud.

This “huge piece of information” is freely accessible on the KM Wiki :slight_smile:

If you select Help from the gear menu of a Find Image action you will be catapulted directly to the relevant Wiki article.

34-pty-fs8

1 Like