How to quickly create PNG thumbnails on all PDF pages?

For this, I use the following code:

for i in `seq 1 $numPages`; do
    convert "$INPUTPDF"[$((i-1))] thumb_$i.png
done;

This is slow, and I think, because every time it starts a new process.

How to do it faster?

Thank you very much in advance!

+3
source share
1 answer

The following was shamelessly stolen :

mikal@deathstar:~/foo$ convert foo.pdf pages-%03d.png
mikal@deathstar:~/foo$ ls pages*
pages-000.png  pages-001.png  pages-002.png  pages-003.png  pages-004.png
mikal@deathstar:~/foo$

This will analyze your pdf file only once. Woot.

, , . SMP-, , convert(1). , . :

for f in *.pdf ; do echo "convert $f `basename $f .pdf`-%03d.png" >> /tmp/runme ; done
wc -l /tmp/runme
split -l [number of lines/2] /tmp/runme
sh /tmp/xaa & sh /tmp/xab &

. , Makefile make(1) -, . , , - .:)

+3

All Articles