How to Convert Multiple Images to PDF in Ubuntu Linux

You have several documents or images scanned individually and you need to save multiple images to one PDF file.

You may find several websites that allow you to do that. But they are either not free or they will put their watermark on the final PDF file. And in any case, I don’t want to upload my documents to some random web server.

I had this need when I had to apply for a job and they required me to upload a single PDF file consisting of several documents. My problem was that I had documents scanned individually but not in one file.

It’s just one of the examples where you may need to convert multiple image files in one PDF file.

In Linux, there are several ways you can combine multiple images into a single PDF file.

  • LibreOffice Draw or even Writer can be used to combine multiple images into PDF
  • gscan2pdf graphical tool can also be used combining multiple images (and single page PDFs) into a single PDF one.
  • The versatile ImageMagic command line tool can be used for converting images into PDF.

I’ll show all the above three methods in this tutorial.

Method 1: Use LibreOffice to combine multiple images into PDF

Open the LibreOffice Draw tool. This is a very handy tool and you can even edit PDF files with it. It is already preinstalled in most distributions so I am not going to discuss the LibreOffice installation in Ubuntu.

The idea here is to add your images in the pages and when you have everything set as per your desire, export everything as PDF. Not only image files, you can also add single page PDF file and combine them together with images into a single PDF file.

combine images to pdf using libreoffice draw
Combine images to PDF using LibreOffice Draw

You can add new pages, insert images or PDF files (also inserted with insert image option) in those pages and then hit the PDF on the top. You’ll have a single PDF file with multiple images with all the images in it.

That was simple. Want even simpler? Use gscan2pdf which is explained in the next section.

Method 2: Use gscan2pdf GUI tool to convert multiple images to PDF

gscan2pdf is a utility that was created for scanning documents, quickly edit them and saving them in PDF. You don’t need a scanner to use it. Simply open it and add images to it.

gscan2pdf is a popular tool and it should be available in the repository of most Linux distributions. You can use your distribution’s package manager or software center to install it.

In Ubuntu, you can find it in the Software Center or use the apt command to install it.

Open a terminal using Ctrl+Alt+T shortcut and use the following command to install gscan2pdf:

sudo apt install gscan2pdf

Once installed, open gscan2pdf by searching for it in the menu

gscan2pdf ubuntu
Start gscan2pdf

Once gscan2pdf is opened, you can select all the required files in it by clicking on the Open Files.

By default,  it is arranged in alphabetical order but you can drag and drop to reorder the images as per your choice.

Once done, you can click on the Save icon to save the files to PDF.

combine images to pdf gscan2pdf
Add files, reorder if needed and click on save icon

When you hit the save button, the next screen might look confusing. Actually it provides you option of putting metadata in the document such as author, date etc similar to a word document.

If you just want a PDF file, hit the save button. Since the default output file is PDF, you don’t need to bother a lot here. Just choose where to save the converted file.

save files withgscan2pdf
Save the file as PDF

Since it is Linux, there is always a way to do the same thing in the terminal. Let me show the command line way of converting images into PDF in the next section.

Method 3: Using command line to convert multiple images to PDF

If you want to go the command line way, you can use ImageMagick. It’s very easy to convert several images into one PDF file this way as well.

Open a terminal and install ImageMagick using the command below:

sudo apt-get install imagemagick

Once you have it installed, use the ‘convert’ command line tool of ImageMagick. Just provide the paths to individual images and at the end of the command, name the output file. For example, something like this:

convert image1.jpg image2.png image3.bmp output.pdf

That’s it. Nothing more to be done. Cool isn’t it? :)

Did it work for you?

I hope this article helped you to merge multiple images into one PDF in Ubuntu Linux. If you are further interested, check this article to know how to edit PDF files in Ubuntu Linux.

Questions, suggestions, a word of thanks is always encouraged.

Similar Posts

  • Thank you Abishek for the CLI tip, and if I have a large (50~100) number of jpgs is there a way to use convert w/o explicitly listing them all in the command argument ? (Kinda like a wildcard file name etc..

  • Convert now chokes on my tiff-files with an error pointing at some security policy. But img2pdf creates PDFs from Tiff. The colorspace option for monochrome PDF (1) appears to be a bit picky and I still have to convert grayscale images to black and white with convert –monochrome, prior creating PDFs.

    tiff2pdf from the libtiff-tools used to work flawlessly, but the PDF format is a bit old. Not that it would not be compatible with current readers, but I want to be on the safer side.