I am looking for ways to generate jpeg thumbnail of pdf files. I would like to do that in Python. Is there any library or can anyone guide me how to do it?
Thanks
I am working on MacOS X Lion. But I would like to run it on Ubuntu or CentOS.
You can use ImageMagick {apt-get install imagemagick on Ubuntu} (it also has Python lib PythonMagick) to convert pdf to images
import subprocess
params = ['convert', 'pdf_file', 'thumb.jpg']
subprocess.check_call(params)
You can also provide parameters at which the image has to generate out of the pdf like
params = ['convert', '-density 300 -resize 220x205', 'pdf_file', 'thumb.jpg']
subprocess.check_call(params)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With