question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pdf2image outputs 1x1 blank image

See original GitHub issue

Describe the bug For some pdf files, convert_from_path, convert_from_bytes outputs a blank 1x1 PIL image. Interestingly for very similar pdfs it works fine. The documents are mostly one very long page pdfs. Any ideais?

To Reproduce Steps to reproduce the behavior:

  1. Unfortunately the pdfs I’m working on are confidential and I am not allowed to share

Expected behavior I would expect to see a normal PIL image, as happened to other similar pdfs.

Screenshots Output: [<PIL.PpmImagePlugin.PpmImageFile image mode=RGB size=1x1 at 0x7FCC6C3FA4A8>]. The number of pages is correct, the pdf is just one very long page.

Desktop (please complete the following information):

  • OS: Ubuntu 16.04

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Belvalcommented, Nov 20, 2018

Can you try with support-cropbox and see if it fixes your issue?

I will upload the new package to PyPi tonight if it does.

1reaction
Belvalcommented, Nov 20, 2018

As pdf2image is only a thin wrapper around pdftoppm, I would try directly from the CLI.

Something like pdftoppm -r 200 -jpeg your_pdf.pdf out.jpg

If you still get a 1x1 pixel then the problem is on their side and I can’t help much.

It would also help if you could provide the exact call you do on convert_from_path/convert_from_bytes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is pdf2image giving me a blank image file?
I had the same issue and solved it by upgrading poppler from version 21.03.0 to 21.11.0.
Read more >
Reference — pdf2image latest documentation
File format or the output images. Supported values are ppm , jpeg , png ... Instead of returning a white background, make the...
Read more >
Frequently Asked Questions for PDF2Image | PDFTron CLI
How can I control the output name for rasterized/converted images? How do I convert PDF to JPEG, PNG, TIF or some other image...
Read more >
PDF to Image - Investintech.com
PDF2Image Command line tool (CLT) comes with seven possible output formats for conversions: ❏ bmp. BMP - Bitmap image file format.
Read more >
pdf2pic - npm
options - see options. pageNumber - page number to be converted to image; isBase64 - if true, convert() will return base64 output instead ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found