Convert Multiple Image Files to PDF Format

Linux offers a very simple way of converting multiple image files to PDF.

For simplicity, it’s best to place all these image files into a single folder.

We can then use the convert command.

To convert all image files and put them into a single multi-page PDF, use:
convert *.jpg output.pdf

In case some of the image files have portrait orientation and some landscape orientation, use the -auto-orient flag:
convert *.jpg -auto-orient output.pdf

To convert all image files into separate PDF files, create a loop:
for file in *.png; do convert "$file" "$file".pdf; done

This will, however, keep the original extension as well, so the final filename will be something like imagefile.png.pdf.

To remove the previous extension during conversion, use:
for file in *.png; do convert "$file" "${file:0:-4}".pdf; done

Leave a Reply

Your email address will not be published. Required fields are marked *