How to make advanced image recognition bots using python

Hello! Today I will show you how to make image recognition bots as fast as possible using Python. I will cover the basics of Pyautogui, Python, win32api and by the end, you should be able to make a bot for pretty much any game.

Here are the commands to run and code to paste:

All code can be found here:

If this video helped you please consider subscribing and leaving a like, it helps a ton!

If you have any errors/suggestions please let me know!

Discord server:


45 thoughts on “How to make advanced image recognition bots using python”
  1. Before reading, make sure you are using python 3.7.0 64 BIT


    These programs require additional setup which I did not include in the video. Please use the idle editor to RUN the code. Feel free to edit or write the code in any editor, but run it with idle.

    2. ImportError: numpy.core.multiarray failed to import

    This is due to the numpy 1.19.4 package which is required for opencv being broken. To fix it uninstall numpy with "pip uninstall numpy" and install the non-bugged version with "pip intall numpy==1.19.3"

    3. Pillow package missing

    For any of you that get "Pillow" package missing problems install it with "pip install Pillow" in the cmd

    4. The script moves the mouse but doesn’t click:

    This is due to the delay between the LEFT DOWN and LEFT UP in the click function being too low. This means that the click is happening too fast and that either your computer is too slow to register it or the computer or whatever program you are using detects it as a “fake click”. To fix it just add more delay, I recommend a time.sleep(0.5)

    5. I am on Mac/Linux and can't install pywin32

    You can use,y) instead, a few comments mentioned that you can edit the click duration by setting pyautogui.PAUSE(0.1) to make the click last for 0.1 seconds for example

    6. I can't rename a file to .py (Windows)

    Open file explorer, click on the "view" tab and check the "View file name extensions" checkbox and then try again

    7. I get permission errors / Don't see the "Edit with idle" button

    Open windows search, search for IDLE, right click it, run as admin, press File-> Open (Or file->New if you want to create a new file) and go from there

    8. Pip is not recognized as an internal or external command

    You forgot to check the "add to path" checkbox when installing python

    Uninstall python and reinstall it while making sure to check the checkbox or follow this stackoverflow post that explains how to add pip to path manually

    9. while I: invalid syntax error

    It's not the letter i, it's the number 1

  2. Best python tutorial I've ever seen, quick and explains everything unlike other torturials that just tells you to past this code and run it, also this can be used in many other thing

  3. Helloo 🙂

    I would like to know something..

    How would you code this Situation

    If locateOnScreen detects 2 identical images that are already saved, click one of the images

    Its like a game where you have to find pair images like there are many symbols and you gotta click the only Symbol pair on the screen

  4. fast pace is good when i thought it was to fash for me i slowed it down cant wait to make my fh5 auction sniping bot v2

  5. uhm when i run the it says ( =======

    Traceback (most recent call last):

    File "C:UserscuberOneDriveDesktopNew", line 9, in <module>

    if pyautogui.locateOnScreen('Stckman.png') != None:

    File "", line 175, in wrapper

    return wrappedFunction(*args, **kwargs)

    File "", line 213, in locateOnScreen

    return pyscreeze.locateOnScreen(*args, **kwargs)

    File "", line 373, in locateOnScreen

    retVal = locate(image, screenshotIm, **kwargs)

    File "", line 353, in locate

    points = tuple(locateAll(needleImage, haystackImage, **kwargs))

    File "", line 207, in _locateAll_opencv

    needleImage = _load_cv2(needleImage, grayscale)

    File "", line 170, in _load_cv2

    raise IOError("Failed to read %s because file is missing, "

    OSError: Failed to read Stckman.png because file is missing, has improper permissions, or is an unsupported or invalid format

    ") i have no idea what this means

  6. I'm using Python 3:10 and I can't install pyautogui. What should I do?

    ERROR: Error [WinError 225] Operation did not complete successfully because the file contains a virus or potentially unwanted software while executing command python egg_info


    ERROR: Could not install packages due to an OSError: [WinError 225] Operation did not complete successfully because the file contains a virus or potentially unwanted software

  7. Can you reply please on how to make the AimBooster click by comparing the picture and not by the color of the target . like you showed with the stickmane detection.
    I can make it detect but not move to or click.

  8. Is it possible to view the number of an item in Pyautogui?

    For ex.
    If I had a game inventory and gave it the image of a specific game item in the inventory, would I also be able to have it read the number of how many of that item is in the inventory?

  9. very good tutorial, sadly this method is too slow for more complex applications. it was still nice to learn and try to apply it on my own projects, thanks

  10. Is there a way to use win32api on linux? If not is there an alternative that would run as fast as win32api and that is available for linux?

  11. Hi ive got a question regarding the installation of pyautogui. I installed thru cmd however whenever I attempt to import in shell it gives me "no module named," I previously had Pycharm and uninstalled however I still get the error. Could you please tell me how to fix? Thanks in advance.

  12. Hello!, I had an issue running the stickman recognition python file as it would keep telling me that 1 was not defined

  13. Tysm man i myself made a bot that plays clash royale and farms masteries while also donating cards to clanmates all automatically all thanks to this video. It's so cool but definitely can optimize it 😀

  14. How do you search for a colour that isn't just black or red or green or blue for the piano tiles bot?
    I want to not only play one of them but the best one has a grayish colour for the tiles.
    Please help!

  15. when i open IDLE (Python 3.7 32-bit) and type import pyautogui when i prees enter it gives me this message Traceback (most recent call last):

    File "<pyshell#0>", line 1, in <module>

    import pyautogui

    ModuleNotFoundError: No module named 'pyautogui'

  16. Hey. Trying to learn python coming from c++ and c# and this toturial was great! Something interesting explained in simple terms. The only problem I am having from this toturial is that sometimes my script double clicks aimboosters targets even though I added the break. I think it might be doing that because the target doesn't instantly disappear and my script wants to click on the shiny cool target.

  17. when I made the file "" , it didn`t say that it was a python file nor does "Edit with Idle" come up when I right click the file

  18. im trying to change things up, my only issue is i want a full rgb selection for the piano thing, (its a special color) in this video only [0] == 0 was required but if i need a full rgb code what should i do instead

  19. when i press q, it stops. the thing i want is if i press q again, it will continue to run. how am i supposed to do 🙁

  20. when i run the code i get this message: ValueError: needle dimension(s) exceed the haystack image or region dimensions

    can you please help?

  21. Bad video, most of the stuff doesn’t work and says syntax error no matter what I do, most of the code doesn’t work, and this dude goes way too fast, Asshat.

Leave a Reply

Your email address will not be published.

Captcha loading...