JPG to PDF: How to Combine Images into PDFs (Free Methods)
·
2 min read
·
Imagic AI Team
Combine JPG images into PDF documents for portfolios, reports, presentations - with and without code.
JPG to PDF: How to Combine Images into PDFs
Combine images into PDF documents. For portfolios, reports, presentations - here's how to do it.
Why Combine Images into PDF?
Common uses:
- Photo albums and portfolios
- Business reports with images
- Presentations
- Product catalogs
- Document scanning
- Archiving
Method 1: Online Tools (Fastest)
Imagic AI
Upload images, reorder, download PDF. Free, no install.
iLovePDF
- Go to ilovepdf.com
- Select "JPG to PDF"
- Upload images
- Arrange order
- Create PDF
Method 2: Python (Best for Automation)
Install
pip install pillow
Combine Images to PDF
from PIL import Image
from pathlib import Path
def images_to_pdf(image_dir, output_pdf, order='name'):
image_path = Path(image_dir)
extensions = ('.jpg', '.jpeg', '.png', '.webp')
images = [f for f in image_path.iterdir()
if f.suffix.lower() in extensions]
if order == 'name':
images.sort()
print(f"Combining {len(images)} images...")
pdf_images = []
for img_file in images:
img = Image.open(img_file)
if img.mode != 'RGB':
img = img.convert('RGB')
pdf_images.append(img)
if pdf_images:
pdf_images[0].save(
output_pdf,
save_all=True,
append_images=pdf_images[1:]
)
print(f"✓ PDF created: {output_pdf}")
images_to_pdf('./photos', 'album.pdf')
With Custom Page Size
from PIL import Image
from pathlib import Path
def images_to_pdf_a4(image_dir, output_pdf, page_size=(210, 297)):
page_width, page_height = page_size
dpi = 72
px_width = int(page_width / 25.4 * dpi)
px_height = int(page_height / 25.4 * dpi)
image_path = Path(image_dir)
images = [f for f in image_path.iterdir() if f.suffix.lower() in ('.jpg', '.png')]
pdf_images = []
for img_file in images:
img = Image.open(img_file)
img.thumbnail((px_width, px_height), Image.Resampling.LANCZOS)
background = Image.new('RGB', (px_width, px_height), 'white')
x = (px_width - img.width) // 2
y = (px_height - img.height) // 2
background.paste(img, (x, y))
pdf_images.append(background)
if pdf_images:
pdf_images[0].save(output_pdf, save_all=True, append_images=pdf_images[1:])
print(f"✓ A4 PDF created: {output_pdf}")
images_to_pdf_a4('./photos', 'album_a4.pdf')
Method 3: macOS Preview
- Select all images in Finder
- Right-click → Open with Preview
- Select all thumbnails (Cmd+A)
- Edit → Select All
- File → Export as PDF
Method 4: Windows Print to PDF
- Select images
- Right-click → Print
- Select "Microsoft Print to PDF"
- Multiple pages option
Summary
- Online tools for quick, one-time jobs
- Python scripts for automation
- macOS Preview for simple needs
- Windows Print for quick PDF creation
Tools
| Tool | Purpose |
|---|---|
| Imagic AI | Quick PDF creation |
| iLovePDF | Online PDF tools |
| Python Pillow | Programmatic PDF creation |
Created 500+ PDFs from images. Questions? Leave a comment.