Page 1 of 1

PDF to multiple PNG files

Posted: 2010-10-24T18:43:56-07:00
by peterpham
Some questions regarding to converting a mutiple page PDF file into multiple PNG files

I have a 3 page PDF file.
Run this command

Code: Select all

convert -density 350 -resize 600 myfile.pdf myfile.png
I receive 3 files (myfile-0.png, myfile-1.png and myfile-2.png) which are good.

I wonder how do I:

1 - add width and height into filename
I tried

Code: Select all

 convert -density 350 -resize 600 -set filename:area '%wx%h' myfile.pdf myfile-%[filename:area].png
it only returns me a single file (myfile-600x288.png). I believe that all of the png in sequence had overwritten the previous one with the same filename. Is it possible to prodoce something like
myfile-600x288-0.png
myfile-600x288-1.png
myfile-600x288-2.png

2 - create multiple sets of images with different size
I tried

Code: Select all

convert myfile.pdf -density 350 \
\( +clone 	-resize 300 -write myfile-small.png +delete \) \
		-resize 600           myfile.png
 
However, the result is:
myfile-0.png
myfile-1.png
myfile-2.png
myfile-thumb.png

Is it possible to produce
myfile-0.png
myfile-1.png
myfile-2.png
myfile-thumb-0.png
myfile-thumb-1.png
myfile-thumb-2.png

Re: PDF to multiple PNG files

Posted: 2010-10-24T20:02:18-07:00
by fmw42
I don't think -write will write more than one image. So you probably have to break this into two command lines.