Search code examples
pythonpython-imaging-libraryocrpython-tesseract

module 'PIL.TiffTags' has no attribute 'IFD'


When I use Pytesseract to recognize the text in an image , I am getting attribute error as

module 'PIL.TiffTags' has no attribute 'IFD'

What could be causing this?

This is the code I am running on google colab

import cv2
import pytesseract
from google.colab.patches import cv2_imshow
img = cv2.imread("img.png")
img = cv2.resize(img, (400, 450))
cv2_imshow(img)
text = pytesseract.image_to_string(img)
print(text)
cv2.waitKey(0)
cv2.destroyAllWindows()

Solution

  • Try checking your Pillow version as shown here. That combined with this solution(to install Teserract) worked for me.