/Image2Text

Image2Text is a class that provides a user-friendly graphical interface for extracting text from images using Tesseract OCR. It allows users to extract text from images by browsing for an image file or getting an image from the clipboard. The extracted text can then be copied to the clipboard..

Primary LanguagePython

Image2Text

The Image2Text class is a graphical user interface (GUI) that allows users to extract text from images using Tesseract OCR.

Untitled

Functionalities !

The main functionalities of the class include:

  • Browsing for an image file and extracting text from it
  • Getting an image from the clipboard and extracting text from it
  • Copying the extracted text to the clipboard
  • Resizing the font of the text_label widget based on the size of the window

Methods

The following methods are defined in the Image2Text class:

init()

Initializes the GUI and sets up the buttons, text label, and progress label.

ocr()

Extracts text from an image using Tesseract OCR.

browse_file()

Opens a file dialog box to browse for an image file and starts a new thread to process the image.

get_clipboard_image()

Gets an image from the clipboard, saves it to a file, and starts a new thread to process the image.

process_image()

Processes the image and extracts text using Tesseract OCR, updates the text label and progress label.

copy_to_clipboard()

Copies the extracted text to the clipboard.

resize_font()

Resizes the font of the text_label widget based on the size of the window.

Fields

The class has the following fields:

  • root : the main tkinter window
  • text_label : the scrolledtext widget that displays the extracted text
  • progress_label : the label that displays the progress of the OCR process.