How to convert JPG to PDF

The article “How to convert PDF to JPG using command line in Linux” shows how to split a PDF file into separate pages while converting them to images.

But what if you want to do the opposite? How to assemble JPG images into a PDF file? This article is devoted to this, which will tell you how to create a single PDF document from JPG files.

The convert utility from the ImageMagick package does a great job of combining images (JPG and other formats) into PDF.

On Debian, Linux Mint, Ubuntu, Kali Linux and their derivatives, you can install this package with this command:

sudo apt install imagemagick

On Arch Linux, Manjaro and their derivatives, run the following commands to install:

sudo pacman -S imagemagick
# To support other formats such as JPEG (JPEG XL and JPEG2000), HEIF, DNG, SVG, WEBP, WMF, OpenRaster, OpenEXR, DJVU, install the following dependencies:
sudo pacman -S ghostscript libheif libjxl libraw librsvg libwebp libwmf libxml2 libzip ocl-icd openexr openexr openjpeg2 djvulibre pango

To convert a single image to PDF, run the following command:

convert PICTURE.jpg RESULT.pdf


convert PL48536179-5.jpg out.pdf

You can specify multiple input .jpg files at once, for example:

convert PL48536179-5.jpg PL48536179-6.jpg PL48536179-7.jpg out.pdf

They will be added one by one to the generated PDF file.

If there are many files and they have a common prefix, then you can use the wildcard character * to add several files at once:

convert PL48536179* out.pdf

Or like this:

convert PL*.jpg out.pdf

The following command will create a PDF file from all JPG files in the current directory:

convert *.jpg out.pdf

By default, a PDF file is created in the highest quality. If you want to reduce the size of the output file, then specify the -quality option with a value less than 100, for example:

convert -quality 70 PL*.jpg out2.pdf

As you can see, the size of the PDF file has indeed decreased:

Online JPG to PDF conversion service

If you are a Windows user, or you do not want to install new utilities and deal with the command line to convert JPG to PDF, then you can collect JPG files into one PDF document on the page of the Online service for converting JPG to PDF: https://suip.biz/?act=convert-jpg-to-pdf

Brief instructions for use are given there, the main point is that if there are several files, then they must be placed in a ZIP archive before uploading.

Leave Your Observation

Your email address will not be published.