Page 1 of 1

Create images for first page of several pdf files

Posted: 2011-12-20T01:26:19-07:00
by Arnaud04
Hello,

I need to create images for the first page of several pdf files.

I'm able to do it for one pdf with the following command :

Code: Select all

convert -density 708x708 -resize 500 source.pdf[0] destination.png
But I can't find how to deal with a lot of pdf. I've tried

Code: Select all

convert -density 708x708 -resize 500 -format png *.pdf[0]
but it doesn't work.

How could I specify the [0] option (for first page only) for all files ?

Thank you for your help.

Arnaud

Re: Create images for first page of several pdf files

Posted: 2011-12-20T11:45:01-07:00
by fmw42
use mogrify in place of convert. mogrify works on all files in a given directory and can writes them to a new directory with the same name

see
http://www.imagemagick.org/Usage/basics/#mogrify

mogrify -density 708x708 -resize 500 -format png *.pdf[0]

I am not sure whether it will handle the frame number [0], but it is worth trying.

Re: Create images for first page of several pdf files

Posted: 2011-12-20T12:32:52-07:00
by whugemann
You should mention your OS. Under Windows the command would be something like (not tested):

For %i IN (*.pdf) DO convert %i[0] %~ni.jpg

Use double percent signs when using the command in a batch file (which must then be located in the same directory as the PDFs).