DEV Community

Cover image for How I Built an AI Image Merge Tool for Combining Two Photos into One Scene
Zi Xin
Zi Xin

Posted on Fully Autonomous

How I Built an AI Image Merge Tool for Combining Two Photos into One Scene

How I Built an AI Image Merge Tool for Combining Two Photos into One Scene
Combining two images sounds simple, but the result often looks like a collage.
The subjects may have different lighting, perspective, scale, shadows, and color temperature. Even when both images look good individually, the combined image may not feel like one real photograph.
That is the problem I wanted to solve with AI Image Merge.
What the product does
AI Image Merge takes two source images and creates one coherent AI-generated composition.
It can be used to:

  • Put two people into one shared moment
  • Place a product into a lifestyle scene
  • Furnish an empty room using a reference image
  • Create a travel portrait
  • Try accessories on a person
  • Mix subjects, colors, and visual styles The workflow is simple:
  • Upload two JPG, PNG, or WebP images
  • Choose a merge direction
  • Add an optional prompt
  • Select an output ratio
  • Generate and download the result as a PNG Each image can be up to 10 MB. Merge presets The product currently includes five presets: Natural Creates a balanced and realistic composition. People Places people from two photos into one shared scene. Product Moves a product into a new environment while preserving its visual details. Room Turns an empty room into a furnished interior based on a reference image. Creative Combines the strongest subjects, colors, and styles from both images. Users can also add instructions such as: Place the person from image one in the cafe from image two.

The main technical challenge
The difficult part is not simply sending two images to an AI model.
The output needs to preserve important details from both sources while matching:

  • Lighting direction
  • Perspective
  • Subject scale
  • Posture and eye line
  • Contact shadows
  • Depth of field
  • Color temperature
  • Background depth
  • Product shape and material The application builds these requirements into preset prompts so users can get better results without writing long prompts themselves. Technical architecture The application is built with Next.js and TypeScript. The image merge flow is asynchronous:
  • The browser requests upload URLs
  • Images are uploaded directly to object storage
  • The server creates a merge task
  • Credits are reserved
  • The task is sent to the configured AI provider
  • The client polls the persisted task status
  • The generated image becomes available for preview and download The provider layer is separate from the product workflow. The project supports providers such as Kie, Replicate, Gemini, and Fal. This means the AI provider can be changed without rewriting the upload, credit, task, or download flow. Pricing and downloads New users receive three free 1K generations after signing up. One credit creates one 1K image. Free-credit downloads include a watermark. Paid generations can be downloaded without a watermark. The product supports both subscriptions and one-time credit packs. Why I built it Many image tools focus on generating a completely new image from text. I wanted a more practical workflow: start with two images that already contain something important, then combine them into one believable result. This makes the tool useful for:
  • Personal portraits
  • Product concept images
  • Interior previews
  • Marketing experiments
  • Social content
  • Creative references Try it here: https://aiimagemerge.com I would love to see what kinds of images people create with it.

Top comments (1)

Collapse
 
zixin profile image
Zi Xin

I built AI Image Merge to solve a problem I kept seeing with image-combination tools: the output often looks like a cut-and-paste collage.
The product focuses on the details that make two source images feel like one photograph, including lighting, perspective, scale, shadows, and color.
It currently offers five merge presets and three free 1K generations for new users.
What would you use it for first: portraits, products, interiors, or something creative?