3

I am using pdf2image to convert a pdf file into image. I am using the method convert_from_path. However, I keep getting the above-mentioned error on google colab. Surprisingly this does not happen when I execute the same code on Jupyter notebook on my local machine.I need to use colab. How do I solve this error?

import pytesseract
import shutil
import os
import random
try:
 from PIL import Image
except ImportError:
 import Image

import cv2
from pdf2image import convert_from_path

from google.colab import files
uploaded = files.upload()

pages=convert_from_path(r"foo.pdf",500)

After executing the following code, I get the error : UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7fe6abfae5f0>

I have installed poppler-utils

0 Answers0