Converting PNG Scans to PDF
January 6, 2006
My old Canon FB 630U USB flatbed scanner will not work in Linux because Canon refuses to release the specifications so that a driver can be written. The W*ndows scanning software does not support scanning to PDF so I save my scans as PNG files and the convert to PDF in Linux using ImageMagick.
The tricky part is getting the dimensions right. I will give two examples.
First, the original scans were 180 dpi 24-bit color, letter size. The
following command creates a letter size 120 DPI color PDF. Adjust the
dimensions after -resize
and -density
for different size originals and
different PDF resolutions as needed. For example, for 150 DPI use 1275x1650
and 150x150
respectively.
$ convert scan.png -resize 1020x1320 -units PixelsPerInch \
-density 120x120 scan.pdf
The following command converts a series of 120 DPI 24-bit color scans
(named scan001.png
, scan002.png
, etc.) to a single 120 DPI 256-color
grayscale PDF:
$ convert scan*.png -compress zip -colors 256 -colorspace GRAY \
-resize 1020x1320 -density 120x120 -units PixelsPerInch output.pdf