AttributeError: type object 'Image' has no attribute 'fromarray'

97 views Asked by At

I am using Jupyter to run my python code and I am getting "AttributeError: type object 'Image' has no attribute 'fromarray'". Please see my code below:

Cell In[1], line 99, in find_text(image)
     96 text_region = thresholded[y:y + h, x:x + w]
     98 # Perform OCR on the text region
---> 99 text = pytesseract.image_to_string(Image.fromarray(text_region))
    101 # Draw the bounding box and text on the text image
    102 cv2.rectangle(text_image, (x, y), (x + w, y + h), (255, 255, 255), 2)

Cell In[1], line 127
    124 shapes_image = find_shapes(cleaned_image)
    126 # Find text in the image
--> 127 text_image = find_text(cleaned_image)
    129 # Get the filename and extension
    130 filename, ext = os.path.splitext(os.path.basename(image_file))

I tried to use Wand library to convert PDF to image

0

There are 0 answers