Page 1 of 1

"Page" numbering when converting a multi page PDF

Posted: 2011-07-21T00:46:32-07:00
by whugemann
The basic command is of course:
convert -density 150 input.pdf -compress group4 output-%02d.tif

or something alike. Numbering will however start at zero and thus the resulting file numbers will be the page numbers of the PDF minus one.
Is there any built-in way to modify this behaviour such that page numbers and file numbers coincide?

Re: "Page" numbering when converting a multi page PDF

Posted: 2011-07-21T09:26:20-07:00
by fmw42
Use -scene 1 see http://www.imagemagick.org/script/comma ... lgp4#scene

convert rose: rose: rose: rose: rose.pdf
convert rose.pdf -scene 1 rose_%d.png

produces:
rose_1.png
rose_2.png
rose_3.png
rose_4.png

Re: "Page" numbering when converting a multi page PDF

Posted: 2011-07-22T00:16:07-07:00
by whugemann
Thank you, Fred, that does the trick!
You can even supply a negative value for -scene, as I have just tested. This is also a common task, because many PDFs contain start pages that have an irregular page count, say with Roman numbers. So the Arabic page number "1" may actually be the fifth page of the PDF (or whatever).

Re: "Page" numbering when converting a multi page PDF

Posted: 2011-07-22T06:52:36-07:00
by anthony
When saving the number you can force the number to always be output with either + or - as appropriate by using %+d or if you like a fixed set of numbers, (say 3 digits with leading zeros) %+03d This will make the filenames list in the right order!