Русский English Tags View Sergey Zolotaryov's profile on LinkedIn Sign-in
How to convert JPG's to a single PDF in Linux without losing quality
Permanent link 01-05-2019 anydoby java linux

I'm often printing stuff for my kids, like old soviet "diafilms". They turn into very nice colorful books where you have a lot of image and little text. Something suited for very small ones. It is quite straightforward to do this in Windows: just select images in Explorer and click Print. No linux file manager has this option out of the box, nor there exists an application that can easily allow you to print a book of images.

So I have to package all my JPG's into a PDF and then you can print it from almost any viewer. Here's my "application" for doing this (I put it to a local ~/bin/makebook):


for i in *.jpg; do img2pdf ${i} > ${i}.pdf; done
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=book.pdf *.jpg.pdf
rm *.jpg.pdf

so, the first line is converting all my JPG's to individual PDF's without losing quality. Unfortunately the img2pdf cannot merge multiple PDF's. The second line "prints" all these files using a virtual printer. The result is a nice book.pdf full of pictures.

Add a comment

Previous article Adjusting volume using mediakeys in openbox