WebTools

307 Useful Tools & Utilities to make life easier.

Image Merger

Combine multiple images together into a single vertical or horizontal image.

Upload Images

Drag and drop multiple images here

Max File Size: 64MB per file
Preview

Add at least two images to see the merged preview.

Understanding the Image Merger

The Image Merger tool provides a highly efficient and streamlined way to combine multiple separate image files into a single unified visual asset. Whether you need to create a vertical storyboard, stack application screenshots for a tutorial presentation, or place multiple portrait photos side-by-side for comparison, this utility handles the spatial math and pixel rendering automatically.

Instead of relying on heavy desktop software or uploading your sensitive images to a remote processing server, the Image Merger processes your files entirely locally within your browser. It utilizes the native HTML5 <canvas> API alongside Alpine.js for highly reactive state management. This architectural decision ensures rapid rendering updates in real-time as you tweak layout settings, change the background color, or manipulate the image order.

Core Features and Technical Behavior

By examining the underlying source code and component logic of the tool, here is an exact breakdown of how it transforms your uploads into a final merged image:

  • Accepted File Formats: You can upload files via the standard file selection dialog or by dragging and dropping them into the designated upload zone. The accepted MIME types are strictly validated and limited to image/png, image/jpeg, image/jpg, and image/webp.
  • Dynamic Size Constraints: The tool programmatically enforces a maximum file size limit that is derived from the server's underlying PHP configuration (specifically calculating the minimum between upload_max_filesize and post_max_size). Any individual image file exceeding this threshold triggers a validation error before the rendering process even begins.
  • Merge Orientation and Algorithms: You are provided with two fundamental directions for stitching your images together:
    • Vertical (Stacked): The script calculates the final canvas width based on the maximum pixel width among all uploaded images. The final canvas height is calculated as the exact sum of the heights of every image. The images are then drawn sequentially from top to bottom.
    • Horizontal (Side-by-side): The final canvas width is calculated as the sum of all individual image widths, while the overall canvas height is determined by the single tallest image in the array. Images are drawn sequentially from left to right.
  • Background Color Padding: Because uploaded images frequently have distinct, mismatched dimensions, merging them inevitably leaves empty negative space on the canvas. To handle this elegantly, the tool includes a "Background Color" input. It initially paints the entire canvas layer with this selected color, ensuring that any negative space not covered by the footprint of a smaller image is filled with a solid, consistent hex color rather than remaining transparent.
  • Dynamic Array Arrangement: As you upload items, they populate an interactive list where they are assigned a unique numeric ID. You can utilize the interface buttons to mutate the internal Alpine.js array, moving elements up or down in the sequence. The HTML canvas redraws itself instantly via a watcher function whenever the array order is modified.
  • Intelligent Output Format Extraction: When you execute the download command, the tool intelligently analyzes the fileType property of the image positioned at index 0 (the very first image in your arrangement list). It then serializes the canvas data to a Base64 URL matching that exact format. For example, if your top image is a PNG, the final stitched file is natively exported as merged_image.png.

A Concrete Worked Example

To better illustrate the internal rendering calculations, consider what happens when you upload two images of varying sizes and choose to merge them vertically.

Input Parameters:

  • Image A: 500 pixels wide by 300 pixels high. Format: JPEG.
  • Image B: 400 pixels wide by 400 pixels high. Format: PNG.
  • Settings: Merge Direction = Vertical, Background Color = #FF0000 (Solid Red).

Step-by-Step Processing Logic:

  1. The script detects a "vertical" merge orientation, so it begins calculating the required bounding box dimensions.
  2. Canvas Width Calculation: It iterates through the images and finds the maximum width between 500 and 400, setting the final canvas width to 500 pixels.
  3. Canvas Height Calculation: It calculates the total sum of the heights (300 + 400), setting the final canvas height to 700 pixels.
  4. A 500x700 pixel HTML canvas is instantiated and filled entirely with the designated hex code #FF0000 (red).
  5. Rendering Image A: Image A is drawn onto the canvas starting at the coordinate points X: 0, Y: 0. It perfectly fills the entire 500px width and occupies the top 300px of height. The internal Y-offset tracker then increments by 300.
  6. Rendering Image B: Image B is drawn at coordinates X: 0, Y: 300. Because it is only 400px wide, it fails to cover the full width, leaving a 100px wide gap on its right side. That 100px gap reveals the red background painted in step 4.
  7. Output Generation: Because the first image in the ordered sequence (Image A) was a JPEG, the download function triggers an automatic export of a 500x700 pixel file named merged_image.jpg.

Frequently Asked Questions

Q: What happens to the original aspect ratio of my images?
A: The Image Merger tool does not stretch, skew, scale, or forcefully crop your images to make them fit. It strictly maintains the original pixel dimensions and aspect ratio of every uploaded file. It accommodates mismatched sizes by intelligently expanding the master canvas and filling unused areas with your chosen background padding color.

Q: Why did my merged output image download as a WebP file?
A: The script programmatically determines the output file extension based solely on the first image in your arrangement list. If the image occupying the very first slot is a WebP file, the final merged canvas will be serialized and downloaded as a .webp file, completely ignoring the file formats of any subsequent images in the list.

Q: Is there a hard limit to the number of images I can stack together?
A: The application code itself does not impose a cap on the array length, meaning you can technically add as many images as you wish. However, you should be mindful that extremely large canvas sizes (for instance, trying to merge 50 high-resolution, uncompressed photographs) will consume significant device memory. If the resulting canvas exceeds your specific web browser's maximum allowable pixel area limit, the preview may fail to render or crash the active tab.

Q: How do I remove a single image from the canvas without clearing everything and starting over?
A: Next to every item in the arrangement settings list, there is a red "X" removal button. Clicking this button simply splices that specific image object out of the internal array. This instantly forces the canvas to recalculate its dimensions and redraw itself, updating the visual preview without affecting your other uploaded images or settings.

Contact

Missing something?

Feel free to request missing tools or give some feedback using our contact form.

Contact Us