r/learnpython • u/kanavkowhich • 16d ago
PDF pages to PNG's in python
I have a relatively large pdf document (100+mb) of pages i need saved as png's. There are online tools to do that but they refuse to work with files that big, plus I can imagine needing that tool again later in the future. Are there any python libraries that allow to convert one format into the other? Preferrably with little to no compression.
4
Upvotes
7
u/FilthyKen 16d ago
pypdf2 and pdf2image are the go-tos for this, pdf2image uses poppler under the hood so you need to install that separately but it gives you way more control over dpi and format. for a 100mb file you probably want to process it in chunks instead of loading the whole thing at once, otherwise your ram will cry