Ubuntu – Convert a directory of JPEG files to a single PDF document

command lineconversionjpegpdf

I have many JPEG files in a directory, and I want to convert them to PDF and concatenate them together to make a single document.

How can this be done?

I would prefer using the command line, as this process will be faster.

Best Answer

From the imagemagick package, use the convert command:

convert *.jpg -auto-orient pictures.pdf

You will get a single pdf containing all jpg in the current folder. The option -auto-orient reads the image's EXIF data to rotate the image.

Install IM with:

sudo apt-get install imagemagick

sources: stackoverflow imagemagick options

Edit: Note that images will be out of specific order if they are not numbered. if you have 10 or more you need to name them ending filename01.jpg...filename99.jpg etc. The leading zeros are required for proper ordering. If you have 100 or more 001...999.