Jump to content
Sign in to follow this  

ImageSearch Transparency

Recommended Posts


I'm searched everywhere and did countless hours of trying to fix this but I just cant get it going.
Im trying to search for an image with a transparency because the image im looking for the background always changes
not allowing me to find it using imagesearch with .bmp files.

I've made a small demonstration photo below of example I've tried with different colored backgrounds none of them worked.


cr(">" & "_ImageSearchStartup()=" & _ImageSearchStartup(), 2)

    ;using Notepad as a simple example
    #Region Notepad Snapshot Creation
    $hWin = WinGetHandle("24bit.png - Paint")
    If Not IsHWnd($hWin) Then
        If Run("mspaint.exe") = 0 Then cr("Couldn't run notepad.exe")
        Local $hWin = WinWait("24bit.png - Paint", "", 10)
        If $hWin = 0 Then cr("Notepad WinWait Timeout!")
    WinSetState($hWin, "", @SW_RESTORE)
    WinSetState($hWin, "", @SW_SHOW)
    Local $testimage = "24bit.png"
    _ScreenCapture_CaptureWnd($testimage, $hWin, 0, 0, -1, -1, False);_ScreenCapture_CaptureWnd ( $sFileName, $hWnd [, $iLeft = 0 [, $iTop = 0 [, $iRight = -1 [, $iBottom = -1 [, $bCursor = True]]]]] )
    cr("made Notepad Window screenshot")
    #EndRegion Notepad Snapshot Creation
Local $h_ImageSearchDLL = -1; Will become Handle returned by DllOpen() that will be referenced in the _ImageSearchRegion() function
Local $y = 0, $x = 0, $result
    $result = _ImageSearch($testimage, 1, $x, $y, 0, 0);_ImageSearch($findImage, $resultPosition, ByRef $x, ByRef $y, $tolerance, $transparency = 0)

   Local $testimage1 = "transwhite.png"
   Local $y1 = 0, $x1 = 0, $result1 ;
    $result1 = _ImageSearch($testimage1, 1, $x1, $y1, 0,  0xFFFFFF);_ImageSearch($findImage, $resultPosition, ByRef $x, ByRef $y, $tolerance, $transparency = 0)  $result1 = _ImageSearchArea("trans.bmp", 1, 0, 0, @DesktopWidth, @DesktopHeight, $x1, $y1, 0, 0xff00ff)
   if $result1 =1 Then
      MouseMove ($x1, $y1, 0)

      cr("+" & "recognised image")




Share this post

Link to post
Share on other sites

I see many topics have talked about this issue!
And the answer is: ImageSearch_DLL does not support search image transparency.

You can learn about PixelSearch(). Maybe it will help your problem!

Stop spam!


Share this post

Link to post
Share on other sites

Many topics has spoken about this issue but it hasn't resolved my problem. I'm also not spamming. 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this