INCLUDE_DATA
( to ) ? be : ! be;
sidebar left sidebar right

Create PDF thumbnails using ImageMagick on Linux (10,045 views)

imagemagick logoI 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)

subscribe to feed

Tags: , , , ,

"Create PDF thumbnails using ImageMagick on Linux" was published on February 3rd, 2008 and is listed in ubuntu.

Comments on "Create PDF thumbnails using ImageMagick on Linux": 7 Comments

  1. 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

  2. PDF e Imagemagick: creare miniature | Imola Blog wrote,

    [...] a Prashanth Ellina « Aggiungere etichetta di testo ai [...]

  3. Slavi wrote,

    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

  4. jabb wrote,

    try to put name.pdf[n] for n page.

  5. I’ve been busy, recent projects « Michael Ellerbeck wrote,

    [...] 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 [...]

  6. Tom wrote,

    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

  7. Boris wrote,

    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.

559772 views

Prashanth Ellina is powered by WordPress

No Complaints Shifter Series Theme by Buzzdroid.com
Computers blogarama - the blog directory Blog Flux Directory Blog Directory & Search engine Computer Blogs - Blog Catalog Blog Directory Computers blogs Bloggeries Blog Directory blog directory Computers Blog Blog Search, Blog Directory p Listed in LS Blogs the Blog Directory and Blog Search Engine Blog Review Blog search - categorized blog directory Link With Us - Web Directory Find Blogs in the Blog
Directory Blog Directory