I want to convert some files with multiple .tif or .pdf pages to separate .png images. From the command line (using ImageMagick) I just do:
convert multi_page.pdf file_out.png
And I get all the pages as separate images (file_out-0.png, file_out-1.png, ...)
I would like to handle this file conversion in Python, unfortunately PIL cannot read .pdf files, so I want to use PythonMagick. I tried:
import PythonMagick im = PythonMagick.Image('multi_page.pdf') im.write("file_out%d.png")
or simply
im.write("file_out.png")
But I only get 1 page converted to png. Of course, I could load each page individually and convert them one at a time. But should there be a way to do them all at once?
source share