I have a bunch of PDF files for which I wanted to generate thumbnails. On looking around a bit, I found “ImageMagick“. Since I have Ubuntu installed, I did
sudo apt-get install imagemagick
It is not too big a download at around 740KB.
To create a thumbnails for all pages in the PDF document (say test.pdf which has 3 pages), do
convert -thumbnail x300 test.pdf test.png ls > test.pdf test-0.png test-1.png test-2.png
The “x300″ tells the “convert” tool to keep the height at 300 pixels and modify the width to suit the height. If you have absolute dimensions in mind (say 400×300), do
convert -thumbnail 400x300 test.pdf test.png
If you want to control the width and have the height suited, do
convert -thumbnail 400 test.pdf test.png
What do you do if you want only the first page’s thumbnail? do,
convert -thumbnail x300 test.pdf[0] test.png
A neat feature of the “convert” tool is creation of animated gif’s having all the pages from the PDF document. do,
convert -thumbnail x300 test.pdf test.gif
“convert” is smart enough to figure out the output format from the file extension you provide in the arguments.
Nifty tools like “convert” from the ImageMagick suite are one of the reasons I love Linux! (ImageMagick is cross-platform, I’m referring the to utility of command-line tools and the UNIX philosophy of specialized tools that do one task really well)
Tags: graphics, imagemagick, linux, thumbnails, tools















Massimo Santi wrote,
It works in Windows too.
For animated gifs you can set the delay between frames with the delay parameter (in hundredths of a second):
convert -thumbnail x300 -delay 100 test.pdf test.gif
Massimo Santis last blog post..Aggiungere etichetta di testo ai PDF
Link | November 20th, 2008 at 8:02 pm
PDF e Imagemagick: creare miniature | Imola Blog wrote,
[…] a Prashanth Ellina « Aggiungere etichetta di testo ai […]
Link | November 21st, 2008 at 3:01 pm