Image grabber 1.0 with Python (final version)

What do you need

Apart from python, you need to install pyscreenshot and pynput

Go in the cmd or in the terminal (or powerhell) or in the linux shell and write:

Maybe you have to write pip3 for mac os.

Remember not to put the i in pynput, because I do it every time and it will not make you find the module.

What is grabimage?

A very simple program to grab images with the mouse. There are similar apps on windows, but I thought this could be useful for other programs in python where you got to get some images from the computer screen, so that you can use them. In particular, I got the intention to make a simple script where I get a screen portion and then I get the text out of the picture ready to be used in some text editor.

The code to grab a part of the screen is here (github repo). You have to click once for the top left corner of the part of the screen you want to get and then at the bottom down corner of the part of the screen you want to get.

In another post we will see how to use this code in other scripts.

Video example of how the code works

Live coding explanation of the script to grab the screen

So, this should be the first step to make the text recognition script. With a couple of lines of code we will be able to do it. In fact the code to make it is already here, we just need to join it with this code to get the image.

Code to get the text out of a picture

As you can see it is really easy. You will need pytesseract. See the post.

OCR: read a text from an image or a photo

See ya in a future post to put all together.

Post written by Avatar A python enthusiast

Higlighted videos

Speech recognition game
Pygame cheatsheets Videos about this map editor
New free game: Crystal of time
How to make a map editor 1
How to make a map editor 2
How to make a map editor 3
Map editor 1.5
Map editor 1.6
How to make a videogame map editor with Python - MEP v. 2.1
Map editor for 2d platform game in Python with Pygame v.3.0
How to save a list with pickle with python
Pygame Map Editor 4.0 for Crystals of time
Github repository
Newest branch (to clone it with git)
git clone --branch cotb2 https://github.com/formazione/timecrystals.git