pdf2image outputs 1x1 blank image
See original GitHub issueDescribe 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:
- 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:
- Created 5 years ago
- Comments:14 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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
.