Feb-03-2021, 01:16 PM
(This post was last modified: Feb-03-2021, 01:16 PM by rachidel07.
Edit Reason: python
)
objective i want to extract text from image. i play a game which an icon appears randomly ,and there is a text(text as image) near to the icon from the right. i want the script take screenshot of the region of the text only. so, i want the script every time he locatonscreen the i con, i want him take screen shot of the text. here is an image to understand the idea :
![[Image: 751Vm.png]](https://i.stack.imgur.com/751Vm.png)
this is my code:
![[Image: 751Vm.png]](https://i.stack.imgur.com/751Vm.png)
this is my code:
import pyautogui as py import time from PIL import Image from pytesseract import * pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe' while 1: indice1 = py.locateOnScreen("icon.png") if indice1: print("indice see it ") myScreenshot = py.screenshot() myScreenshot.save(r'C:\Users\rachidel07\Desktop\ok\venv\image.png') img=Image.open("image.png") output = pytesseract.image_to_string(img) print(output) else: print ("non")
buran write Feb-03-2021, 01:14 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.