This Python script converts images to text using the Tesseract OCR library. The output text is displayed in a colorful format.
- Python 3.x
- Tesseract OCR installed on your system
- On Ubuntu:
sudo apt-get install tesseract-ocr
- On Windows: Download and install from Tesseract GitHub Releases
- On Ubuntu:
-
Clone the repository:
git clone https://github.com/your-username/image-to-text-converter.git](https://github.com/vinetsuicide/screenshot2text.git cd screenshot2text
-
Install the required Python packages:
pip install -r requirements.txt
-
Run the script with the path to the image file as a command-line argument:
python3 ss2text.py "ur image"
The converted text will be displayed in a colorful format.
You can customize the colors in the script (colorful_output
function) according to your preferences.
The script consists of two main functions:
- image_to_text(image_path): Opens an image file and uses Tesseract OCR to extract text.
- colorful_output(text): Prints the converted text in a colorful format.
- image_path: Path to the image file that you want to convert to text.