Please bookmark this page to avoid losing your image tool!

Two Photo Merger

(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, secondImageSrc = '', layout = 'horizontal', gap = 10, alignment = 'center', bgColor = '#ffffff') {
    return new Promise((resolve) => {
        const parsedGap = isNaN(Number(gap)) ? 0 : Number(gap);

        function mergeImages(secondImg) {
            const canvas = document.createElement('canvas');
            const ctx = canvas.getContext('2d');
            
            const w1 = originalImg.width;
            const h1 = originalImg.height;
            const w2 = secondImg.width;
            const h2 = secondImg.height;

            if (layout === 'vertical') {
                canvas.width = Math.max(w1, w2);
                canvas.height = h1 + h2 + parsedGap;
                
                ctx.fillStyle = bgColor;
                ctx.fillRect(0, 0, canvas.width, canvas.height);
                
                const x1 = alignment === 'start' ? 0 : alignment === 'end' ? canvas.width - w1 : (canvas.width - w1) / 2;
                const x2 = alignment === 'start' ? 0 : alignment === 'end' ? canvas.width - w2 : (canvas.width - w2) / 2;
                
                ctx.drawImage(originalImg, x1, 0);
                ctx.drawImage(secondImg, x2, h1 + parsedGap);
            } else if (layout === 'blend') {
                canvas.width = Math.max(w1, w2);
                canvas.height = Math.max(h1, h2);
                
                ctx.fillStyle = bgColor;
                ctx.fillRect(0, 0, canvas.width, canvas.height);
                
                const x1 = (canvas.width - w1) / 2;
                const y1 = (canvas.height - h1) / 2;
                ctx.drawImage(originalImg, x1, y1);
                
                const x2 = (canvas.width - w2) / 2;
                const y2 = (canvas.height - h2) / 2;
                ctx.globalAlpha = 0.5;
                ctx.drawImage(secondImg, x2, y2);
                ctx.globalAlpha = 1.0;
            } else if (layout === 'pip') { // Picture-in-picture
                canvas.width = w1;
                canvas.height = h1;
                
                ctx.fillStyle = bgColor;
                ctx.fillRect(0, 0, canvas.width, canvas.height);
                
                ctx.drawImage(originalImg, 0, 0);
                
                const pipWidth = canvas.width * 0.25;
                const ratio = pipWidth / w2;
                const pipHeight = Math.max(1, h2 * ratio);
                
                const padding = parsedGap;
                ctx.drawImage(secondImg, canvas.width - pipWidth - padding, canvas.height - pipHeight - padding, pipWidth, pipHeight);
            } else { // Defaults to 'horizontal' side-by-side
                canvas.width = w1 + w2 + parsedGap;
                canvas.height = Math.max(h1, h2);
                
                ctx.fillStyle = bgColor;
                ctx.fillRect(0, 0, canvas.width, canvas.height);
                
                const y1 = alignment === 'start' ? 0 : alignment === 'end' ? canvas.height - h1 : (canvas.height - h1) / 2;
                const y2 = alignment === 'start' ? 0 : alignment === 'end' ? canvas.height - h2 : (canvas.height - h2) / 2;
                
                ctx.drawImage(originalImg, 0, y1);
                ctx.drawImage(secondImg, w1 + parsedGap, y2);
            }
            
            resolve(canvas);
        }

        if (!secondImageSrc) {
            // Uses original image as a duplicate for demonstration if no second image URL is provided 
            mergeImages(originalImg);
        } else {
            const img2 = new Image();
            img2.crossOrigin = 'Anonymous';
            img2.onload = () => mergeImages(img2);
            // Fallback to merge duplicate original instance if external URL fails
            img2.onerror = () => mergeImages(originalImg); 
            img2.src = secondImageSrc;
        }
    });
}

Free Image Tool Creator

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

Description

The Two Photo Merger tool allows you to combine two separate images into a single cohesive image using several different layout modes. Users can merge images side-by-side (horizontally), stack them vertically, blend them together with transparency, or create a picture-in-picture effect. The tool offers customization options such as adjusting the gap between images, selecting background colors, and choosing different alignment settings. This is useful for creating comparison shots, side-by-side photo collages, or artistic overlays for social media and presentations.

Leave a Reply

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

Other Image Tools:

Two Photo Combiner

Three Photo Merger Tool

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

See All →