We are going to explain how we can convert images into JPG to PDF format In an easy way. If you want to carry out 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, to go from JPG to PDF with a simple tool as we will be able to see. By the way, there are also web pages to carry out this type of conversions completely online and for free ...
To carry out this type of conversion we need to install the package in our favorite distro imagemagick or the package gscan2pdf, depending on whether we want the command line method or the graphical method. 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 its name as we have indicated here, and once installed, now we go to the steps you must follow to be able to transform one or more JPG images into PDF.
Table of Contents
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 quite practical command line tools and 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 in the / home directory to PDF or just one. For this you can use the first or the second of the commands that follow:
cd /home convert *.jpg nombre.pdf convert foto.jpg nombre.pdf
In the first, all the JPEG images are passed to PDF at once and in the second, only a specific one that matches that name. You can also use compression with the + compress, -rotate option to rotate the image by the degrees you specify as a parameter, etc. For example, you can rotate the image 90 degrees and add compression with the following command:
convert -rotate 90 foto.jpg +compress nombre.pdf
But if commands are not your thing, then you can move on to the next section ...
JPEG to PDF conversion using a graphical interface:
Assuming that we already have the gscan2pdf program, let's see that the procedure is quite simple. The steps are:
- We open gscan2pdf.
- We add the images or we select the directory where the images we want to convert are located.
- 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.
- Once put in order we can click on the button Save to save.
- Now a screen will appear where we can choose many Options, including changing the metadata of the PDF, 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, since it supports other formats ...
- We accept and it will generate the PDF with our images.
I hope it has helped you, for more suggestions or doubts, do not forget to leave your comments...