r/learnpython • • Oct 07 '26

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

12 comments sorted by

View all comments

Show parent comment

7

u/agent_kater Oct 07 '26

Pdfimages or imagemagick maybe?

When did GhostScript stop being the default tool for this?

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -r300 -o "page-%03d.png" "input.pdf"

1

u/masoomjethwa Oct 07 '26

Best option.