I’m using GhostScript to convert PDFs to PNGs, the problem is that for each page I’m calling:
gs -sDEVICE=pnggray -dBATCH -dNOPAUSE -dFirstPage=10 -dLastPage=10 -r600 -sOutputFile=image_10.png pdf_file.pdf
Which is not good, I want to pass dFirstPage=10 dLastPage=30 for example and make GhostScript automatically extract each page in a SEPARATE png file WITH the PAGE-NUMBER in the filename, without starting it again with different sOutputFile…
I know it’s probably something simple but I’m missing it…
Also, it would be great if someone can tell me what parameter I need to pass to make ghostscript run in total silence, without any output to the console.
EDIT: Adding %d to the output parameter adds the number of the run, instead of the number of the page. For example:
-dFirstPage=10 -dLastPage=15 -sOutputFile=image_%d.png
results in:
image_1.png, image_2.png, image_3.png etc… instead of:
image_10.png, image_11.png, image_12.png …
Save this as a file
Check in the ghost script manual to see if there is a
-dPage=${num}option, else use-dFirstPage=${i} -dLastPage=${i}.Then make it executeable
chmod 755 batch_gs.shFinally run it with arguments
(Lightly tested).
I hope this helps.