Find image of specific size

I am using a Keyboard Maestro script to stamp an "Approved" or "Rejected" stamp on an invoice, based on the user's decision. The stamp is supposed to be placed somewhere in the upper third of the document on the screen. Besides that, it is preferred that the stamp is used on an empty, blank white space. This is a problem since the format of an invoices vary significantly among vendors.

Is there a way to find the biggest white/blank spot on the upper third of the front window?

Thanks,
Andrej

This would be quite hard to do in Keyboard Maestro. I can't think of any easy way, I would probably have to resort to some sort of image scripting system to figure it out, and even then I'm not sure what algorithm would find this. I would maybe break the image down in to a relatively course grid (like 50 * 20), and then mark each point on that grid as either “basically white” or not. And then I would try to find areas within that grid that were mostly basically white.

If I had this problem I would just select Approved or Rejected based on a keystroke and the location based on a click. Or perhaps I would click for Approved and Shift-click for Rejected.

Thank you Peter. I will test this options and pick the most convenient one.