Simple setup — a macro with two actions:
- Find Image on Screen (expanded(
- If-Then-Else (expanded) with a Found Image condition and nothing in the Then or Else
The two actions use the same image, a tiny problematic image I am trying to target on the screen. Both actions have Display checked. Must be Unique is off in the Find Image on Screen action. Both use the default fuzz factor. Both look on "all screens". (I have two.)
Three images are found, as expected: the icon well in each of the two actions and the target image elsewhere on the screen However! If I collapse the If-Then-Else then neither of the other two images is highlighted. (Collapsing the Find Image on Screen action doesn't affect anything.) I can't see how this could possibly happen — what am I missing?
Here's the macro:
Weird Find Image on Screen Problem.kmmacros (47 KB)

For small grey images, Keyboard Maestro has a hard time finding them. They look the same as everything else from its point of view. There is several passes trying to find good matches and then looking for the best of them. For images like these there can be thousands of “sort of ok matches” and these can drown out the real ones before Keyboard Maestro gets a chance to look more closely.
In this case, since you know you are looking for them in the menu bar presumably, why not restrict the area of the screen. Assuming your main screen is on your left, and at the same top height as your second screen, then something like:
0, 0, SCREEN(2,Right), 50
If the area being searched is less than a quarter of your total desktop space, then Keyboard Maestro switches to a more expensive, but more accurate, search method.
Yes, I have run into the tiny-image search problem before, and you explained it to me. What I was pointing out here is that in fact the macro does find the images appropriately when the second one in the macro is visible but not when it’s not, which seems like a clear bug, or at least a mystery.
I have investigated such edge cases before and what it is is that there are lots and lots of close matches at a rough level. Keyboard Maestro picks the best of those and then looks more closely at them. But if there are enough rough matches they can drown out the real matches before they get looked at more closely.
It comes back to performance. In order for the Found Image system to be useful, it needs to be fast - accurately scanning the entire screen for small matches takes a long time (even on a fast Mac it takes ~ 10 seconds). So corners need to be cut to make it work fast enough to be useful. But small grey images that are similar to most of the reset of the screen are one of the places where the corner cutting results in problems.
I will probably expose more control over the speed/accuracy trade off in the future, but for now, the control is automatic based on the area searching - if the area is less than a quarter of the screen it switches to more accurate but slower.
No problem, just thought it might be something you wanted to know about. It just seemed so weird that giving the search fewer targets to confuse it made it find none at all.