• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

SMASHING LAB

GUIDES | LINUX | GEEKY STUFF

  • Nginx
  • Linux
  • Guide
  • Ubuntu
  • WordPress
  • Drones, My Hobby

How to Convert JPG to PDF in Linux

By Imran Yousaf

We are going to explain how we can convert images in JPG format to PDF in an easy way. If you intend to perform the reverse action, you may also be interested in the command line program called pdfimages to dump the images contained in a PDF to JPEG format. But what we are looking for in this article is just the opposite, going from JPG to PDF with a simple tool as we will be able to see. By the way, there are also websites to carry out this type of conversion completely online and for free …

To carry out this type of conversion, we need to install the imagemagick package or the gscan2pdf package on our favorite distro , depending on whether we want the command line method or the graphic method. The installation is quite simple, you just have to use the package management tools used by the distribution you are using and install the package by name as we have indicated here, and once installed, we now move on to the steps you must follow to be able to transform one or several JPG images into PDF.

Convert JPG to PDF from command line:

If you have opted for the command line option and have installed the imagemagick package, in that case, once installed, we can have access to a series of command line tools and quite practical options. We are going to use the convert command to perform the conversion. The truth is that it has a multitude of options, so I recommend that you review the manual.

But the most basic thing, which is what we are looking for with this tutorial, would be to perform the conversion from the directory where the image or images are located. For example, imagine that we want to transform all the images from the / home directory to PDF or just one. For this you can use the first or the second of the following commands:

1
2
3
cd /home
convert *.jpg my_file.pdf
convert my_image.jpg my_file.pdf

In the first, all the JPEG images are passed to the PDF at once, and in the second, only a specific one that coincides with that name. You can also use compression with the + compress, -rotate option to rotate the image the degrees you specify as a parameter, etc. For example, you can rotate the image 90 degrees and add compression with the following command:

1
convert -rotate 90 foto.jpg +compress nombre.pdf

But if yours are not the commands, then you can go to the next section …

JPEG to PDF conversion using a graphical interface:

gscan2pdf

Assuming that we already have the gscan2pdf program, we will see that the procedure is quite simple. The steps are:

  1. We open gscan2pdf.
  2. We add the images or select the directory where the images that we want to convert are located.
  3. Once added, we can reorder them by dragging them from the main screen of the application, from the list of images that appears just to the left.
  4. Once put in order we can click on the Save button to save.
  5. Now a screen will appear where we can choose many options, including changing the PDF metadata, adding a name, date, type, author, source, etc. Although it is not necessary to fill them if we do not need it. What is important is to select All if we want to convert all the images as PDF pages and in the output format choose the PDF format, since it supports other formats …
  6. We accept and the PDF will be generated with our images.

I hope it has helped you, for more suggestions or questions, do not forget to leave your comments …

Some more articles you might also be interested in …

  • Top 5 Linux Distributions for Programmers
  • How to Shutdown Linux System from a Terminal
  • 20 Awesome Nmap Command Examples for Linux
  • How to Avoid Accidental File Deletion in Linux
  • Crontab Examples: Running Cron Jobs in Linux
  • Simple, Reliable and Convenient Monitoring of Linux Servers
  • How To Dual Boot Linux/Ubuntu and Windows 10…
  • How to Install LAMP Stack (Linux, Apache, MySQL,…
Tweet
Pin
Share
0 Shares

Filed Under: Guide

Primary Sidebar

  • Twitter
  • Facebook
  • Google+

Recent Posts

  • How to install Nextcloud on CentOS 8
  • How to install Zabbix on openSUSE Leap 15.1
  • How to Easily Configure Your Domain’s Email Account with Gmail?
  • Tails 4.4 OS Released with Tor Browser 9.0.6
  • How to Convert JPG to PDF in Linux

Subscribe to our Newsletter

Useful articles, tips and videos about creating and promoting websites to your mail



* required field


  • Contact Us
  • Privacy Policy
  • About Us

Copyright © 2021. Smashing Lab