Recently I had to convert some scans to pdf. Unfortunately the scaned documents were only available as jpg, so I was looking for a way to convert these (huge) images into one pdf. First I thought ok, let’s use convert (which is part of ImageMagick, however it turned out that the output pdf got either bloated (700kbyte -> 11Mbyte!!!) or had poor quality when the images where previously scaled down.
After trying heaps of tools with unsatisfying results, I finally found a package called leptonica-progs, which provides a tool called converttops to convert images directly into ps files while preserving good quality and holding down the file size.
Install leptonica-progs:
aptitude install leptonica-progs
preprocess images to reduce filesize:
convert input.jpg - resize 50% output.jpg
convert jpg to ps:
/usr/bin/leptonica/converttops input.jpg output.ps
convert ps to pdf:
ps2pdf *ps
join the pdf files into a single one:
pdfjoin *pdf

Leave a comment