Python Forum

Full Version: Read Text From Image
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am new to Python and i want to extract text from Image, in the below i am getting some images text as same Image but some images are very good and easily readable but below code is not able to extract the text.

But when i use online link to extract text then the online tool is extracting all the text as it is from image.
Online Link : https://smallseotools.com/image-to-text-converter/

How can i handle to extract all text from images.

Note : I can;t share image publically

 

import io
import requests
import pytesseract
from PIL import Image, ImageFilter, ImageEnhance
pytesseract.pytesseract.tesseract_cmd = r"C:\Users\ADMIN\AppData\Local\Tesseract-OCR\tesseract.exe"
response = requests.get('https://www.google.com/7cb71799-3cd2-4bff-aeb7-7ff7ec7d371b.jpeg')
img = Image.open(io.BytesIO(response.content))
imagetext = pytesseract.image_to_string(img)
print(imagetext)