Ticker

6/recent/ticker-posts

Image to text Converter

 



Image to text converter Python Program

This is a Python Program to convert image to text. When you scan an image of some text it will automatically detect the text written and display it in the console.

Download the following requirements 

# Add OCR setup from https://github.com/UB-Mannheim/tesseract/wiki
# add python library using pip install tesseract and pip install pytesseract 


Program -

import pytesseract
import os
from PIL import Image

pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe" #Path to the tesseract

def convert():
    img = Image.open('Life-quote.jpg') # Add the image name here
    text = pytesseract.image_to_string(img)
    print(text)

convert()

Post a Comment

0 Comments