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)
Tagged: graphics, imagemagick, linux, thumbnails, tools
2 Trackbacks
[...] a Prashanth Ellina « Aggiungere etichetta di testo ai [...]
[...] is how to make a thumbnail of a pdf http://blog.prashanthellina.com/2008/02/03/create-pdf-thumbnails-using-imagemagick-on-linux/ you will need to install ImageMagick and then [...]
5 Comments
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
Is there are way to :
1) Get all the pages of the PDF or some info ?
2) How to specify the page e.g. thumbnail out of page 5 ?
Slavis last blog post..Learning English with Youtube
try to put name.pdf[n] for n page.
Dont forget, this runns only when GhostScript is installed.
And my Question ist, how to convert only on special Page in a PDF-Document…?
Whats the parameter ??
thx Tom from Vienna…
Toms last blog post..KUNSTFABRIK WIEN – LAMBERT VAN BOMMEL
to convert just a single page simply add [] to the filename. Just like:
convert -thumbnail 400 test.pdf[0] test.png
for the first page.