The Image2Text class is a graphical user interface (GUI) that allows users to extract text from images using Tesseract OCR.
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
The following methods are defined in the Image2Text class:
Initializes the GUI and sets up the buttons, text label, and progress label.
Extracts text from an image using Tesseract OCR.
Opens a file dialog box to browse for an image file and starts a new thread to process the image.
Gets an image from the clipboard, saves it to a file, and starts a new thread to process the image.
Processes the image and extracts text using Tesseract OCR, updates the text label and progress label.
Copies the extracted text to the clipboard.
Resizes the font of the text_label widget based on the size of the window.
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.