I have used this code to read text from an image file. Reading text from image
The code is as follows
from PIL import Image
from pytesseract import image_to_string
image = Image.open("image.jpg",'r')
myText = image_to_string(Image.open(open('maxresdefault.jpg')),config='-psm 10')
myText = image_to_string(Image.open(open('maxresdefault.jpg')))
print(myText)
Error: UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 278: character maps to
Tried to solve this error from following:UnicodeDecodeError: 'charmap' codec can't decode byte X in position Y: character maps to <undefined>
Then got error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte