Please bookmark this page to avoid losing your image tool!

Three Photo Merger Tool

(Free & Supports Bulk Upload)

Drag & drop your images here or

The result will appear here...
You can edit the below JavaScript code to customize the image tool.
async function processImage(originalImg, imgUrl2 = "", imgUrl3 = "", layout = "horizontal", backgroundColor = "#ffffff", gap = 10) {
    // Utility to load secondary images or fallback to the original image
    const loadImage = (src) => new Promise((resolve) => {
        if (!src || typeof src !== 'string' || src.trim() === '') {
            return resolve(originalImg);
        }
        const img = new Image();
        img.crossOrigin = "Anonymous";
        img.onload = () => resolve(img);
        img.onerror = () => resolve(originalImg); // Fallback on failure
        img.src = src;
    });

    // Wait for additional images to load
    const img2 = await loadImage(imgUrl2);
    const img3 = await loadImage(imgUrl3);

    // Sanitize parameters
    gap = parseInt(gap);
    if (isNaN(gap)) gap = 10;

    layout = (layout || "").toLowerCase();
    if (!["horizontal", "vertical", "grid"].includes(layout)) {
        layout = "horizontal";
    }

    // Get natural dimensions safely with a fallback
    const w1 = originalImg.naturalWidth || originalImg.width || 1;
    const h1 = originalImg.naturalHeight || originalImg.height || 1;
    const nw2 = img2.naturalWidth || img2.width || 1;
    const nh2 = img2.naturalHeight || img2.height || 1;
    const nw3 = img3.naturalWidth || img3.width || 1;
    const nh3 = img3.naturalHeight || img3.height || 1;

    let w2, h2, w3, h3;
    let tw, th; // Final canvas total width and height
    let x1, y1, x2, y2, x3, y3; // Image coordinates

    // Calculate layout coordinates and dimensions
    if (layout === "horizontal") {
        // Scale images 2 and 3 to match the height of image 1
        h2 = h1; 
        w2 = (nw2 / nh2) * h1;
        h3 = h1; 
        w3 = (nw3 / nh3) * h1;
        
        tw = w1 + w2 + w3 + (gap * 2);
        th = h1;
        
        x1 = 0; 
        y1 = 0;
        
        x2 = w1 + gap; 
        y2 = 0;
        
        x3 = w1 + w2 + (gap * 2); 
        y3 = 0;
        
    } else if (layout === "vertical") {
        // Scale images 2 and 3 to match the width of image 1
        w2 = w1; 
        h2 = (nh2 / nw2) * w1;
        w3 = w1; 
        h3 = (nh3 / nw3) * w1;
        
        tw = w1;
        th = h1 + h2 + h3 + (gap * 2);
        
        x1 = 0; 
        y1 = 0;
        
        x2 = 0; 
        y2 = h1 + gap;
        
        x3 = 0; 
        y3 = h1 + h2 + (gap * 2);
        
    } else { 
        // Grid: image 1 and 2 side by side, image 3 full width below them
        h2 = h1; 
        w2 = (nw2 / nh2) * h1;
        
        let row1Width = w1 + w2 + gap;
        
        w3 = row1Width; 
        h3 = (nh3 / nw3) * w3;
        
        tw = row1Width;
        th = h1 + h3 + gap;
        
        x1 = 0; 
        y1 = 0;
        
        x2 = w1 + gap; 
        y2 = 0;
        
        x3 = 0; 
        y3 = h1 + gap;
    }

    // Set up canvas
    const canvas = document.createElement("canvas");
    canvas.width = tw;
    canvas.height = th;
    const ctx = canvas.getContext("2d");

    // Optional Background fill 
    if (backgroundColor && backgroundColor.toLowerCase() !== "transparent") {
        ctx.fillStyle = backgroundColor;
        ctx.fillRect(0, 0, tw, th);
    }

    // Render smooth imagery
    ctx.imageSmoothingEnabled = true;
    ctx.imageSmoothingQuality = 'high';

    // Draw images to canvas 
    ctx.drawImage(originalImg, x1, y1, w1, h1);
    ctx.drawImage(img2, x2, y2, w2, h2);
    ctx.drawImage(img3, x3, y3, w3, h3);

    return canvas;
}

Free Image Tool Creator

Can't find the image tool you're looking for?
Create one based on your own needs now!

Description

The Three Photo Merger Tool allows you to combine up to three separate images into a single cohesive image. Users can choose from different layout options, including horizontal, vertical, or a grid arrangement, and can customize the output with a specific background color and adjustable spacing between the photos. This tool is useful for creating photo collages, side-by-side comparisons, or social media graphics and mood boards.

Leave a Reply

Your email address will not be published. Required fields are marked *

Other Image Tools:

AI Image Idea Search and Generator

AI Powered Image Tool Creator

AI Image Topic Identifier and Idea Generator

Movie and Film Name Style Identifier Tool

Home Style Image Namer

Man In Space Image Generator

Audio and Video Language Dubbing and Localization Text Search Tool

Movie and Film Identifier via TMDB or IMDB from Image

Image To Movie Name Identifier

Image To Movie Scene Identifier

Image To Movie Identifier

Image Based Website Interface SEO Finder Tool

Image To Emoji Converter

VHSRip VCR Style Black Color Image Filter

SEO Topic Search And Idea Generator Tool

Video Audio Track and Language Player and Downloader

Lab Website Icon Search and Topic Generator Tool

HIFI STEREO VHSRip Language Dubbing and Text Localization Tool

Image To Website Interface Address Extractor

Image Prompt Idea Generator and Tool Creator Studio

MP4 DVDRip Video and Photo Language Dubbing Translator Player

Music Audio Mp3 Song Lyric Extractor

Video Platform Audio Track and Language Localization Text Translator

Image Description Text Generator

Video Platform Audio Track and Localization Metadata Screenshot Tool

Video Audio Track and Language Translator Tool

Video and Audio Metadata and Format Information Extractor Tool

Video Platform Screenshot and Rip Effect Converter

YouTube Video Audio Track and Auto Dubbing Translator Player

YouTube Auto-Dubbing Multi-Language Audio Track Translator Tool

Video Platform Audio Track and Text Language Translator Tool

AI Video Language Dubbing and Translation Generator

Image To Movie Name and Film Title Extractor

Online Image Tools

Photo Face Mask Adder

YouTube Video To Image Frame Extractor

See All →