Image to Text; Text/Code Grabber
A downloadable tool for Windows, macOS, and Linux
Dependencies: Tesseract-OCR
----> (its hard to find so you can direktly download it above with the Dependency:_Windows64BitTesseractInstaller)
if you dont have a windows 64 bit computer you can download Tesseract from
here --> https://github.com/tesseract-ocr/tesseract
IMPORTANT: in the installation DONT change the path
===========================================================
How to use:
Use enter to create the rectangle (the grabber needs to be focused)
===========================================================
If you want to expand on this project, heres the source code
-(please credit me somewhere and dont steal it)-
---------------------------------------------------------------------------------------------------
import pyautogui from PIL import Image import pytesseract import ctypes import time # the default path to tesseract pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe' def show_message_box(message, title="Rectangle_Drawer"): ctypes.windll.user32.MessageBoxW(0, message, title, 1) def capture_rectangle(): show_message_box("Select the top-left corner of your rectangle") top_left = pyautogui.position() show_message_box("Select the bottom-right corner of your rectangle") bottom_right = pyautogui.position() # rectangle to image screenshot = pyautogui.screenshot(region=(top_left[0], top_left[1], bottom_right[0] - top_left[0], bottom_right[1] - top_left[1])) return screenshot def extract_text_from_image(image): # Analyze the Rectagle text = pytesseract.image_to_string(image) return text def start_grabbing(): rectangle_image = capture_rectangle() # Extract Text from Rectangle extracted_text = extract_text_from_image(rectangle_image) # Print the text print(extracted_text + "\n\n\n\n\n" + "==================================================================" "==================" + "\nThanks for using my text/code grabber. I hope the experience was fast and satisfying. " "\nIf you want to see more projects I made, go to:\nhttps://laverine.itch.io/") y_o_n = input("Do you want to grab something else (Y)es or (N)o ? ") if y_o_n.lower() == "y": start_grabbing() elif y_o_n.lower() == "n": exit() else: start_general() def start_general(): n_o_y = input("Do you want to grab something (Y)es or (N)o ? ") print("\n====================================================================================\n\n\n\n") if n_o_y.lower() == "y": start_grabbing() elif n_o_y.lower() == "n": exit() else: start_general() start_general()
===========================================================
Credits:
Ocr-Tesseract: https://github.com/tesseract-ocr/tesseract
===========================================================
Download
Install instructions
===========================================================
Dependencies: Tesseract-OCR
----> (its hard to find so you can direktly download it from here)
if you dont have a windows 64 bit computer you can download Tesseract from
here --> https://github.com/tesseract-ocr/tesseract
===========================================================
Leave a comment
Log in with itch.io to leave a comment.