PDF documents are used for just about anything these days, and are usually considered to be a very professional way to send important data such as contracts or terms for businesses and other formal entities. If you have a JPG image – perhaps the scan of a signed document, for example – you can convert this to a PDF document, which would be a more formal file extension to use for such a matter. In this tutorial, you will learn how to convert a JPG image to a PDF document on a Linux system via command line and GUI.
In this tutorial you will learn:
- How to convert JPG to PDF via GUI
- How to convert JPG to PDF via command line
|Requirements, Conventions or Software Version Used
|Any Linux distro
|Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to convert JPG to PDF (command line)
The ImageMagick software suite makes conversion from JPG to PDF a breeze on the command line. It is free and easy to install from the official software repository on any Linux distro, and you may find that it comes in handy for lots of other image manipulation tasks down the road.
You can use the appropriate command below to install ImageMagick with your system’s package manager.
$ sudo apt install imagemagick
$ sudo dnf install imagemagick
$ sudo pacman -S imagemagick
After ImageMagick has been installed, check out the command examples below to see how to convert JPG to PDF with the
convert Linux command.
- To convert a single JPG image to PDF format, try the following
$ convert image.jpg -auto-orient document.pdf
The previous command will convert an image with the name
image.jpgto a PDF document named
-auto-orientoption will read the EXIF metadata (if present) of your JPG image to figure out how to orient the image before making it into a PDF document. This option is not strictly necessary, but is recommended so the images do not turn out rotated incorrectly.
- If you have multiple JPG images that you want to place into a single PDF document, you can use a wildcard character in your command to select all the images:
$ convert *.jpg -auto-orient document.pdf
- Or to convert the other way (PDF to JPG):
$ convert document.pdf image.jpg
How to convert JPG to PDF (GUI)
One of the easiest ways to convert a JPG to PDF from the desktop environment would be with LibreOffice, a common suite of software that is often installed by default or can easily be installed with the system package manager. Follow the step by step instructions below to convert one or more JPG images to PDF with LibreOffice:
- Start by opening LibreOffice. More specifically, the LibreOffice Writer application.
- Now that you are loaded into a new, blank document, access the Insert > Image option from the top menu bar.
- Select one or more JPG images from the file browser, then click ‘Open.’
- With our image now inserted into the LibreOffice document, go to the File > Export As > Export As PDF option at the top.
- On the next menu, you can configure all of your pertinent PDF settings. Perhaps the most relevant are the JPG compression options, which allow you to decide how much quality versus size you want to retain in your final document. When done, click on ‘Export’ and pick a location on your computer to save the document.
In this tutorial, we saw how to convert a JPG image into a PDF document on a Linux system. There are numerous ways to perform this task, with ImageMagick making the process easy via the command line, and LibreOffice being the go to method for the GUI method. Whether this is just a one off circumstance where you need to convert a JPG image, or you need to bulk convert to PDF on a regular basis, both tools make the process painless and easy for Linux users.