How to Merge JPG Files into One Image (3 Methods Compared)
How to merge JPG files into one image using browser tools, desktop software, and command line. Three methods compared with speed benchmarks and quality tests. Free, no upload.
I needed to merge 14 receipt scans into one image for an expense report last month. The first tool I tried uploaded all my files to a server, slapped a watermark on the output, then asked for $12 to remove it. The second tool crashed my browser tab after the 8th image. The third produced a PDF when I specifically wanted a JPG. (If you actually need PDF output, there is a way to combine JPG to PDF without losing quality.)
After testing a dozen options, three approaches actually work reliably. Each has a specific use case where it wins.
Method 1: Browser-based JPG merger (best for 2-30 images)
Browser tools run the merge inside your browser using the HTML5 Canvas API. You pick your images, choose a layout (vertical, horizontal, or grid), and download the result. No installation, no signup.
How the Canvas API actually works: Your browser loads each image into memory as a bitmap - raw pixel data. The tool creates a canvas element sized to fit all images in your chosen layout. It draws each image onto that canvas at calculated coordinates. Then it calls canvas.toDataURL('image/jpeg', quality) to compress and export the final JPG. Zero network requests touch your image data.
I timed a 20-image merge (each photo 4032x3024 px, average 4.2 MB) across three browser tools:
| Tool | Time | Output size | Privacy |
|---|---|---|---|
| JPG Joiner | 3.2s | 18.4 MB | Client-side only |
| Aspose JPG Merger | 8.7s | 22.1 MB | Server upload |
| ImageOnline Merge | 6.1s | 19.8 MB | Server upload |
The speed difference comes down to network upload time. Server-based tools spend 3-5 seconds uploading your images before processing even starts. Client-side tools skip that entirely.
Where browser tools fail: Memory. Each 4032x3024 image consumes about 48 MB of RAM as an uncompressed bitmap (width x height x 4 bytes per pixel). Twenty images eat nearly 1 GB just for the source bitmaps, plus the canvas itself. On a phone with 3 GB total RAM, you will see browser tab crashes around 15-20 large images. On desktop with 8+ GB, I have gone past 100 images without issues.
Method 2: Desktop software (best for 30+ images or repeated batches)
For large batches, desktop tools avoid the browser memory ceiling by streaming images from disk. ImageMagick is the standard.
Vertical merge of all JPGs in a folder:
magick convert *.jpg -append merged-vertical.jpgHorizontal merge:
magick convert *.jpg +append merged-horizontal.jpgGrid layout (4 columns):
magick montage *.jpg -tile 4x -geometry +5+5 grid.jpgImageMagick handles 500+ images without flinching because it can read and discard images one at a time instead of holding all bitmaps in memory simultaneously. The tradeoff is setup: you need to install it (via Homebrew on Mac, apt on Linux, or the Windows installer), and the command-line interface has a learning curve.
Quality note: ImageMagick's -append re-encodes the image by default. Set -quality 95 to control compression. For truly lossless vertical/horizontal joins (no re-encoding), use jpegtran - but it only works when image widths are multiples of the JPEG MCU size (usually 8 or 16 pixels). This means images shot at 4032 px wide work (4032 / 16 = 252), but a 1000 px crop would not.
Batch merging with GIMP's Script-Fu
GIMP can merge JPGs through its Script-Fu console (Filters > Script-Fu > Console) if you already have it installed. The scripting language is a Scheme dialect from 1997 - all nested parentheses - but it handles transformations during the merge better than ImageMagick. Rotating every other image 90 degrees, adding 20 px borders between photos, or resizing inputs to a fixed width before joining is more readable as a Script-Fu procedure than piped shell commands.
The downside is performance. I batch-merged 40 product photos (3000x2000 each) on a 16 GB Windows machine and GIMP took 22 seconds - about 7x slower than ImageMagick. GIMP loads every image as a layer in RAM simultaneously and redraws the canvas preview after each operation. For straight vertical or horizontal joins, stick with ImageMagick.
XnView MP as a GUI alternative
XnView MP is what I recommend to people who hear "command line" and close the tab. Free for personal use, runs on Windows, Mac, and Linux. The merge function lives under Tools > Create Contact Sheet - confusing name, but it is effectively a grid merge tool. Set columns to 1 for vertical, pick spacing and background color, hit Create.
I tested it with 50 scanned documents at 300 DPI and it rendered in about 4 seconds on an i5-12400. The limitation: XnView MP uses strict uniform cell sizes, so images with different aspect ratios get padded with background color instead of packing tightly. ImageMagick's -append packs images flush regardless of size, which looks cleaner for documents and receipts.
Method 3: Programming languages (best for automation)
If you merge images as part of a larger workflow - generating reports, processing uploads, building catalogs - writing code gives you full control.
Python with Pillow (the most common approach):
from PIL import Image
import os
files = sorted(f for f in os.listdir('.') if f.endswith('.jpg'))
images = [Image.open(f) for f in files]
total_height = sum(img.height for img in images)
max_width = max(img.width for img in images)
merged = Image.new('RGB', (max_width, total_height))
y = 0
for img in images:
merged.paste(img, (0, y))
y += img.height
merged.save('merged.jpg', quality=92)This script vertically stacks all JPGs in the current directory. For 20 images at 4032x3024, it runs in about 2.1 seconds on an M1 MacBook. Memory usage peaks at around 1.4 GB because Pillow holds all images in RAM simultaneously. For very large batches, load and paste one image at a time instead of building the full list first.
Which method to pick
| Scenario | Use this | Why |
|---|---|---|
| Quick merge of 2-30 photos | Browser tool | Zero setup, instant result |
| 50+ images or daily batches | ImageMagick | No memory ceiling, scriptable |
| Part of a larger code pipeline | Python / Pillow | Full programmatic control |
| Sensitive documents (IDs, medical) | Client-side browser tool | Files never leave your device |
If you are only combining two photos rather than a large batch, the process is simpler. I cover four quick ways to combine two photos into one JPG in a separate guide. For grid-based layouts like social media grids and product photo sheets, the photo collage maker gives you styled templates with borders and spacing. If your source files are screenshots or diagrams where text sharpness matters, the PNG merger outputs lossless PNG instead of JPG.
Common mistakes when merging JPG files
Mixing wildly different resolutions
A 4000 px wide photo next to a 640 px screenshot creates an awkward composition. The small image floats in padding, and the output file is dominated by dead space. Resize to a consistent width before merging - the bulk resizer handles entire folders at once - or use grid layout which handles mixed sizes better than vertical/horizontal stacking.
Forgetting about color profiles
Phone cameras save JPGs in Display P3 color space. Screenshots use sRGB. When you merge them, the Canvas API converts everything to sRGB, which can shift colors slightly on wide-gamut photos. If color accuracy matters (product photography, design work), convert all images to sRGB before merging. On Mac, use sips --matchTo '/System/Library/ColorSync/Profiles/sRGB Profile.icc' *.jpg.
Using 100% quality when you do not need it
The difference between 92% and 100% JPG quality is invisible to the human eye in most photos, but the file size difference is 2-3x. A merged image of 20 photos at 100% can hit 60+ MB - too large for most email attachments (25 MB limit) and slow to load on web pages. Use 92% as your default and only bump to 100% for archival or print production.
Merging JPG files on mobile - what actually works
Half the time I need to merge images I am standing in a parking lot combining photos of a fender bender for an insurance claim. Phone merging has problems that desktop users never hit.
iOS limits
Safari on iOS 17/18 caps each tab at roughly 1.2-1.4 GB of memory on 6 GB iPhones (iPhone 15 Pro, 16 Pro). A single 12 MP photo decodes to about 48 MB as a raw bitmap, so you can merge around 20-25 photos before Safari silently reloads the tab and your selections vanish. On the iPhone SE 3rd gen (4 GB RAM), that drops to 12-15 images. I lost a 20-image merge three times on an SE before realizing the crash happened during canvas rendering.
A useful shortcut: long-press a photo in Files or Photos, tap Copy, then paste directly into a browser merge tool. Skips the file picker and the iOS Photos permission prompt. Saves about 5 seconds per image.
Android limits
Chrome on Android degrades gracefully instead of crashing - the UI freezes for 2-3 seconds at a time, then Android's low-memory killer terminates the tab. A Samsung Galaxy S23 (8 GB RAM) handled 40 rear-camera photos. A Pixel 6a (6 GB RAM) topped out around 30. Budget phones with 3-4 GB RAM (Moto G Power, Samsung A14) struggle past 10-15 full-resolution photos.
Watch for the Google Photos file picker quirk: selecting JPGs from Google Photos triggers full-resolution downloads from cloud storage. Thirty offloaded photos means 200+ MB of downloads before the merge starts. Pick from "Files" instead of "Photos" in the picker to use local copies.
Safari vs Chrome rendering
Safari converts Display P3 to sRGB during canvas drawing, shifting reds and greens by a few percent. Chrome preserves sRGB as-is. Photos merged in Safari may look slightly less saturated on non-Apple screens.
The bigger issue: Safari caps canvas size at 16384 x 16384 pixels. Stack 7+ full-resolution iPhone photos vertically (each 4032 px tall) and the canvas silently renders blank - white output, no error. Chrome allows 32767 x 32767. Resize inputs to 50% when you hit this on Safari. If your captures overlap (consecutive screenshots of a scrolling page), the screenshot stitcher detects the overlap and joins them cleanly. For a full walkthrough of the phone workflow - including HEIC conversion and the iOS clipboard shortcut - see the guide to merging JPG files on your phone without an app.
File naming and organization before merging
The order images appear in the merged output depends on how your tool sorts input files. Get this wrong and page 3 ends up before page 1.
Sort order traps
Most tools sort alphabetically, so image2.jpg comes after image19.jpg (the character "2" has a higher ASCII value than "1"). The fix: use zero-padded names like 001-front.jpg, 002-back.jpg, 003-detail.jpg. A shell command handles bulk renaming:
ls *.jpg | cat -n | while read n f; do mv "$f" "$(printf '%03d-%s' $n "$f")"; doneEXIF date sorting vs filename sorting
Some tools sort by "date taken" from EXIF metadata. This breaks when you mix photos (with EXIF dates) and screenshots (often no EXIF date at all). The tool puts dateless images at one end, scrambling your intended order. I hit this merging product photos with annotated screenshots - the screenshots all clustered at the end because their DateTimeOriginal field was empty.
Filename sorting is more predictable. You control the names, so you control the order.
How different tools handle ordering
Browser tools use file picker order. On macOS, Finder reorders to match its sort regardless of click sequence. On Windows, Ctrl-click selection order is preserved. Same files, different merge order depending on OS.
ImageMagick's *.jpg glob uses locale-dependent shell sorting. Mixed-case filenames (IMG_001.jpg and img_002.jpg) sort differently in en_US vs C locale. Use magick convert @filelist.txt -append merged.jpg with an explicit file list to guarantee order. Python's os.listdir() is even worse - the return order varies by OS (random on ext4 Linux, alphabetical on macOS APFS). Always wrap it with sorted().
Frequently asked questions
Does merging JPG files reduce image quality?
It depends on the output compression setting, not the merging process itself. At 92% JPG quality, the merged output is visually identical to the originals but 40-60% smaller in file size. At 100%, you keep every pixel as-is but the file balloons. The Canvas API used by browser tools re-encodes the image, so some generation loss is unavoidable. Desktop tools like ImageMagick can do lossless appending of JPGs, but only for vertical/horizontal joins where the MCU boundaries align (both images must have widths divisible by 16).
What is the maximum number of JPG files I can merge at once?
Browser-based tools hit the memory ceiling of your device. On a desktop with 8 GB RAM, 100+ images at 3000x2000 px each work fine. On a phone with 3 GB RAM, expect smooth performance up to about 30 images. Desktop software like ImageMagick has no practical limit since it can stream images from disk. The bottleneck shifts from RAM to disk speed after about 500 images.
Can I merge JPG and PNG files together?
Yes. Most merge tools accept mixed formats. The Canvas API converts everything to its internal bitmap representation before drawing, so a PNG with transparency gets composited onto the background color (white by default). If you need to preserve transparency, output as PNG instead of JPG. Note that PNG output files are 3-8x larger than JPG for photographic content.
Ready to merge your JPG files?
No signup, no upload, no watermark. Just drag your images and download the result.