FindImagePos and return_offset

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

FindImagePos and return_offset

Post by kpassaur » Fri May 24, 2019 4:04 pm

I can't seem to get the return_offset correct. I want the top left and bottom right. This comes from the help file.

return_offset is used to determine which coordinates should be returned and can be one of the following:

0 Top left position of located image within bitmap_to_scan. In other words X, Y is the top left corner of needle_bitmap within haystack
1 Center: X,Y will be set to the center of the located image within the main haystack image.
2 Top right
3 Bottom left
4 Bottom right
5 Middle top
6 Middle bottom
7 Middle left
8 Middle right

Code I am using - notice the 0 and 4 for top left and bottom right

FindImagePos>c:\temp2\region.JPG,SCREEN,0.7,0,TXArr,TYArr,NumFound,CCOEFF
FindImagePos>c:\temp2\region.JPG,SCREEN,0.7,4,BXArr,BYArr,NumFound,CCOEFF

MDL>%TXArr_0%,%TYArr_0%,%BXArr_0%,%BYArr_0%,c:\temp2\area2.JPG

This is what comes from the message box
3678,97,3678,97,c:\temp2\area2.JPG (both appear to be the top left

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: FindImagePos and return_offset

Post by JRL » Fri May 24, 2019 8:40 pm

Hi Keith,
The image offset parameter only works with BMP or PNG files. Only returns top left location of JPGs no matter what you attempt to specify.

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Re: FindImagePos and return_offset

Post by kpassaur » Fri May 24, 2019 8:44 pm

I didn't notice that in the help file. I'll think of something else.

Thanks

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: FindImagePos and return_offset

Post by Marcus Tettmar » Wed May 29, 2019 5:38 pm

JPG aren't supported *AT ALL* in this function. The help file says:

needle_bitmap should be a fully qualified path to a bitmap or png file (see MatchAlgorithm type below for supported image types).

MatchAlgorithm goes on to say that EXACT *only* works with BMP files while CCOEFF works with PNG or BMP

Again - there is no support for JPG.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts