Transform folders full of images into organized text with a single click! This desktop application features a modern graphical interface to batch OCR (Optical Character Recognition) all images within a folder and then compile all extracted text into a single, chronologically sorted file. πͺπΈπ¬π§ Supports OCR in Spanish and English.
- Modern GUI: π
Simple, minimalist, and user-friendly interface built with
CustomTkinter
. - Batch OCR: ποΈ Processes all images (
.png
,.jpg
,.jpeg
,.bmp
,.tiff
) within the selected folder. - Multilingual Support: πͺπΈπ¬π§ Text recognition optimized for Spanish and English using
EasyOCR
. - Chronological Order: π°οΈ Images are processed and text is compiled based on the image file's modification date and time (oldest first).
- Unique Output Filenames: π‘οΈ Prevents overwriting of
.txt
files when images share the same base name but have different extensions (e.g.,photo.png
andphoto.jpg
), by saving asphoto.png.txt
andphoto.jpg.txt
. - Text Compilation: π Combines all extracted text from individual unique
.txt
files into a single output file. - Clear Separators: π The compiled file includes separators indicating the unique source
.txt
filename (e.g.,imagename.ext.txt
) for each text snippet. - Overwrite Option: β Prompts you whether to overwrite existing
.txt
files or use their content if OCR has already been performed. - Background Processing: βοΈ OCR and compilation run in a separate thread to keep the UI responsive.
- Detailed Status Logging: π Displays progress and any errors in a textbox within the GUI.
- GPU Support: β‘ Attempts to use GPU for faster OCR if available and configured (via PyTorch and CUDA).
- Document Digitization: π Convert scans or photos of documents into editable text.
- Note Archiving: βοΈ Extract text from screenshots of presentations or handwritten notes (quality may vary).
- Data Collection: π Gather textual information from large sets of images.
- Accessibility: ποΈβπ¨οΈ Create text versions of visual content for screen readers.
- Research Organization: π Quickly group text from multiple visual sources into a single document for review.
- Easy to Use: π The graphical interface simplifies the process; no command line needed for basic use.
- Time-Saving: β±οΈ Automates the tedious process of individually OCRing images.
- Organized: ποΈ Chronological ordering and unique filenames/separators help maintain text traceability.
- Flexible: π€Έ The option to overwrite or use existing files is useful for resuming or updating.
- Potentially Portable: π» As a Python script, with the right dependencies, it could run on various operating systems.
- Dependencies: π§± Requires installation of several Python libraries (
CustomTkinter
,EasyOCR
,OpenCV
,PyTorch
, etc.). - OCR Quality: πΌοΈ OCR accuracy heavily depends on the quality of the input images (resolution, lighting, font clarity).
- Initial Model Download: β³ The first time it's used (or with a new language like Spanish),
EasyOCR
will download language models, which can take time. - Resource Usage: π» OCR, especially in batch, can be CPU/GPU and memory intensive.
- Error Handling: π While errors are handled, very complex scenarios or heavily corrupted files might still cause issues.
-
Clone the Repository (or download the
.py
file):git clone https://github.com/m4iccc/Python-OCR-Batch-script.git cd Python-OCR-Batch-script
(Replace the URL and directory name accordingly)
-
Install Dependencies: Ensure you have Python 3.7+ installed. Then, install the required libraries using pip:
pip install customtkinter easyocr opencv-python-headless numpy torch torchvision torchaudio
Note:
torch
,torchvision
,torchaudio
are required byEasyOCR
. Check the EasyOCR documentation for specific PyTorch version compatibility if you encounter issues, especially with GPU usage. -
Run the Application: Navigate to the directory containing the script in your terminal and run:
python Python OCR Batch script.py
(Make sure to use the correct filename if you saved it differently).
-
Use the GUI:
- Click the
Browse...
button to select the folder containing your images. The selected path will appear next to the button. - Click the large
Click me to Batch OCR and Compile!
button. - If existing unique
.txt
files (from previous runs, e.g.,imagename.ext.txt
) are found, you'll be prompted whether to Overwrite them (Yes), Use Existing ones where available (No), or Cancel the process. - Watch the progress and any messages in the status text box at the bottom.
- Once completed, you'll find:
- Individual unique
.txt
files for each processed image (e.g.,photo.png.txt
,scan.jpg.txt
) inside your selected folder. - A single compiled file named
_compiled_ocr_output_by_time.txt
(or similar) inside the same folder, containing all the text ordered chronologically by image modification time.
- Individual unique
- Click the
This project is licensed under the GNU General Public License v3.0.
A copy of the license should be included in the repository (e.g., in a file named LICENSE
). You can view the full license text here:
https://www.gnu.org/licenses/gpl-3.0.html
- CustomTkinter for the amazing modern GUI library.
- EasyOCR for the powerful and accessible OCR library.
Feel free to fork, contribute, or open issues! β