Converting PDF pages to a single image
I am always amazed how far one can get by chaining the output of simple programs
to create something bigger. This time, I had to convert the pages of a PDF file
to a single PNG thumbnail image. As I learned in five minutes this is super
simple with pdftoppm, Imagemagick’s convert tool and a Makefile to hook it
up together:
:
What I do here is calling pdftoppm to generate numbered PNG files with a
tmp- prefix. convert reads them, appends them horizontally (denoted by the +
sign), resizes the final image to a height of 320 pixels and filters the output
with an unsharp mask to “recover” some of the lost sharpness.
To make the pages stand out you can also add a black single pixel frame and a white separation border with
: