I am having issues with Gdip image search, it works most of the time but there is one small bmp it fails to find on the screen
when i made a log to display results the bitmap value is slightly bigger then the haystack of the screen
here is my code and log below it
Code: Select all
FImg(img, transBool:=0, ByRef x:=0, ByRef y:=0, locX:=0, locY:=0, locW:=0, locH:=0)
{
Log("F FImg " . img . " " . transBool . " " . x . " " . y . " " . locX . " " . locY . " " . locW . " " . locH)
SysGet, VirtualWidth, 78
SysGet, VirtualHeight, 79
if (not locW)
{
locW := VirtualWidth
Log("-locW " . locW)
}
if(not locH)
{
locH := VirtualHeight
Log("-locH " . locH)
}
if transBool
{
trans := "0"
img .= ".png"
Log("-trans " . trans)
}
else
{
img .= ".bmp"
}
Log("-img " . img)
pToken := Gdip_Startup()
haystack := Gdip_BitmapFromScreen(0)
needle := Gdip_CreateBitmapFromFile(img)
Log("-pToken " . pToken)
Log("-haystatck " . haystack)
Log("-needle " . needle)
if transBool
{
trans := "0"
Log("-trans " . trans)
}
if Gdip_ImageSearch(haystack, needle, XY, locX, locY, locW, locH, 20, trans)
{
coords := StrSplit(XY, ",")
x := coords[1]
y := coords[2]
Log("-coords " . x . " " . y)
Gdip_DisposeImage(haystack)
Gdip_DisposeImage(needle)
Gdip_Shutdown(pToken)
if XY
{
Log("F FImg End")
return 1
}
Log("FImg Failed")
return 0
}
Gdip_DisposeImage(haystack)
Gdip_DisposeImage(needle)
Gdip_Shutdown(pToken)
Log("FImg Failed")
return 0
}
Code: Select all
F FImg divide 0 0 0 0 0 0 0
-locW 1366
-locH 768
-img divide.bmp
-pToken 650795531
-haystatck 55648008
-needle 55649176
FImg Failed