A modern web application for extracting visible text from images using advanced OCR (Optical Character Recognition) technology. Built with Flask, OpenCV, Pillow, and Tesseract OCR for accurate text extraction from various image formats.
- Upload images in multiple formats (PNG, JPG, JPEG, GIF, BMP, TIFF)
- Automatic image preprocessing with OpenCV for enhanced OCR accuracy
- Advanced text extraction using Tesseract OCR
- Real-time text extraction and display
- Clean, responsive web interface
- Cross-platform compatibility (Windows, Linux, macOS)
Windows:
Download and install from UB Mannheim’s Tesseract page (commonly recommended for Windows users).
Default path: C:\Program Files\Tesseract-OCR
Linux (Ubuntu/Debian):
sudo apt update
sudo apt install tesseract-ocrmacOS:
brew install tesseract- Open Start Menu → search "Environment Variables" → Edit the system environment variables.
- Click "Environment Variables".
- In "System Variables", select
Path→ Edit → New. - Add your Tesseract install directory (e.g.
C:\Program Files\Tesseract-OCR). - Restart your terminal.
Test installation:
tesseract -vgit clone https://github.com/shakiliitju/Image-to-Text-Converter.git
cd Image-to-Text-ConverterInstall dependencies using the included requirements.txt file:
pip install -r requirements.txtThe requirements.txt includes:
Flask
opencv-python
pytesseract
Pillow
numpy
requests
-
Configure Tesseract Path: Make sure Tesseract is installed and the path in
app.pyis correct:pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
-
Start the Flask Application:
python app.py
-
Access the Application: Open your web browser and navigate to http://127.0.0.1:5000
-
Upload and Process: Select an image file and click upload to extract text from the image.
Image-to-Text-Converter/
│
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── LICENSE # MIT License file
├── README.md # Project documentation
├── uploads/ # Directory for uploaded images
├── templates/ # HTML templates
│ └── index.html # Main web interface
└── static/ # Static files (CSS, JS)
├── style.css # Stylesheet
└── script.js # JavaScript functionality
-
Tesseract not found error:
- Ensure Tesseract is properly installed
- Verify the path in
app.pymatches your installation - Add Tesseract to your system PATH
-
Poor OCR results:
- Use high-resolution images with clear text
- Ensure good contrast between text and background
- Try preprocessing the image manually if needed
-
Flask server not starting:
- Check if port 5000 is available
- Ensure all dependencies are installed
- Run
pip install -r requirements.txtagain
- This tool extracts visible text overlays from images, not diagnostic scan data
- For optimal results, use high-resolution images with clear, readable text
- Supported image formats: PNG, JPG, JPEG, GIF, BMP, TIFF
- For PDF or DICOM support, convert pages/files to image format before uploading
- The application automatically preprocesses images using OpenCV for better OCR accuracy
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
MIT License