You’ve scanned a few pages with your phone, or you’ve got a set of receipts as JPGs, and you need them as one PDF to email or file. The web is full of “JPG to PDF” sites that want you to upload the lot — not ideal when the images are receipts, an ID, or a signed document.
WSL combines images into a PDF locally, for free. The standout tool is img2pdf, which embeds your JPGs without re-encoding them, so the PDF is small and the images stay pixel-perfect. ImageMagick is the fallback when you need more control.
No WSL yet? See the WSL install guide.
Install the tools
sudo apt update && sudo apt install -y img2pdf imagemagick
img2pdf is the recommended tool here; imagemagick is the alternative.
The simple case: one image to PDF
img2pdf photo.jpg -o photo.pdf
That wraps the JPG into a single-page PDF, lossless, in a fraction of a second.
Combine many images into one PDF
List the files in the order you want them as pages:
img2pdf page1.jpg page2.jpg page3.jpg -o document.pdf
To grab every JPG in a folder, use a glob — but mind the ordering (see the next section):
img2pdf *.jpg -o document.pdf
Get the page order right
Pages come out in the order the files are listed. A glob like *.jpg sorts alphabetically, which trips people up: page10.jpg sorts before page2.jpg. Two reliable fixes:
- Zero-pad the numbers when naming:
page01.jpg,page02.jpg, …page10.jpg. - List explicitly in the exact order you want on the command line.
To check the order a glob will use before committing:
ls -1 *.jpg
The ImageMagick alternative
ImageMagick also builds PDFs and can mix in resizing or other edits:
magick *.jpg document.pdf
It re-renders the images rather than embedding them, so the file can be larger and slightly lossy. Its bigger catch is the security policy:
Which command to use
| img2pdf a.jpg -o a.pdf | Single image to PDF, lossless |
|---|---|
| img2pdf *.jpg -o doc.pdf | All JPGs in a folder into one PDF |
| img2pdf 01.jpg 02.jpg -o doc.pdf | Explicit page order |
| magick *.jpg doc.pdf | ImageMagick (re-encodes; may be blocked) |
Mixing JPG and PNG
You can combine both in one PDF — just list them in order:
img2pdf scan1.png scan2.jpg scan3.png -o combined.pdf
Each file becomes a page. The format mix doesn’t matter; the order on the command line does.
Wrapping up
Turning images into a PDF on Windows is one command: img2pdf *.jpg -o document.pdf for a lossless, compact result, or magick *.jpg document.pdf if you need ImageMagick’s extra handling (and don’t hit the policy block). The thing to watch is page order — zero-pad your filenames or list them explicitly.
It’s free, it runs in WSL, and your scans and documents never get uploaded anywhere. To go the other way and pull images back out of a PDF, see convert PDF to JPG or PNG.