Belval / pdf2image

A python module that wraps the pdftoppm utility to convert PDF to PIL Image object
MIT License
1.6k stars 194 forks source link

Maximum JPG size? #204

Closed kfordaccela closed 3 years ago

kfordaccela commented 3 years ago

When downloading a PDF and converting it to JPG for faster processing I'm receiving an error that I believe is related to a very wide file. Page width is 200.00 inches by .88 inches tall. Is it possible to confirm the maximum page size that can be used for JPG conversion.

python command given: n_images = convert_from_path(fileDownload[1], use_pdftocairo=True, thread_count=3, fmt="jpeg", output_folder="./n_images/", last_page=2500)

Error Given: Traceback (most recent call last): File "C:\Users\kford\PycharmProjects\CrystalReportTester\main.py", line 261, in TestReports o_images = convert_from_path(fileDownload[0], use_pdftocairo=True, thread_count=3, fmt="jpeg", output_folder="./o_images/", last_page=2500) File "C:\Python39\lib\site-packages\pdf2image\pdf2image.py", line 218, in convert_from_path images += _load_from_output_folder( File "C:\Python39\lib\site-packages\pdf2image\pdf2image.py", line 517, in _load_from_output_folder images.append(Image.open(os.path.join(output_folder, f))) File "C:\Python39\lib\site-packages\PIL\Image.py", line 3023, in open raise UnidentifiedImageError( PIL.UnidentifiedImageError: cannot identify image file './o_images/73b2d8f3-c9b9-4cab-92c7-dc9247f0fb78-0001.jpg'

kfordaccela commented 3 years ago

was able to confirm that the issue was use_pdftocairo=True no longer an issue at this point.