How to convert JPG to PDF
April 3, 2022
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.
For details on installing ImageMagick, including which dependencies need to be installed to support the maximum number of formats, see the article: ImageMagick guide: installing, using, and troubleshooting.
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.
- How to convert PDF to JPG using command line in Linux (SOLVED) (100%)
- Error “convert: delegate failed `'potrace' --svg --output '%o' '%i'' @ error/delegate.c/InvokeDelegate/1911” (SOLVED) (68.8%)
- What program to open .docbook files (DocBook) (67.3%)
- How to split a large file (text or binary) into smaller files (SOLVED) (64%)
- How to composite and append images on the Linux command line (overlay and merge images) (63.8%)
- How Squid ACL works (RANDOM - 50%)