Image Stitching Layout Math and Browser Canvas Limits
How combined-image dimensions are calculated in match and original modes, how alignment works, and why browsers cap canvas size.
Primary Browser Tool
Image Combiner & Stitcher
Join images side by side or stack them vertically into one long image with spacing, alignment, and background options.
Two Axes: Along and Across
A row or a stack has a direction in which images are placed one after another, the “along” axis, and a perpendicular “cross” axis. For a horizontal row, along is width and cross is height; for a vertical stack it is the reverse. Every layout rule can be stated once in these terms.
Match Mode and Original Mode
In match mode, the target cross size is the smallest cross size among the images. Each image is scaled by target ÷ its own cross size, and its along size is multiplied by the same factor so proportions are preserved. Because the target is the minimum, every factor is 1 or less: nothing is enlarged, so nothing is blurred by upscaling.
In original mode no image is scaled. The cross size of the canvas is the largest among the images, and smaller ones are offset by zero (start), half the difference (center), or the whole difference (end).
| Quantity | Formula |
|---|---|
| Along size of canvas | sum of along sizes + gap × (n − 1) + 2 × padding |
| Cross size of canvas | largest cross size + 2 × padding |
| Scale factor (match mode) | smallest cross size ÷ image’s cross size |
| Cross offset (original mode) | 0, (max − size) ÷ 2, or (max − size) |
A Worked Example
Two images, 400 × 200 px and 100 × 100 px, are combined side by side in match mode with a 10 px gap and 5 px padding. The target height is 100. The first image is scaled by 0.5 to 200 × 100; the second is unchanged. The canvas is 200 + 10 + 100 + 10 = 320 px wide and 100 + 10 = 110 px tall. The first image is drawn at x = 5 and the second at x = 215.
Why There Is a 16,384 Pixel Ceiling
Browsers impose maximum canvas dimensions, and they also limit total area. The exact values vary by browser and device, but 16,384 px per side is the common safe upper bound; beyond it a canvas may silently fail and produce a blank image. Memory is the underlying constraint: a canvas needs four bytes per pixel, so 16,384 × 4,000 px already occupies about 250 MB before encoding.
When a layout would exceed the limit, the tool computes a single factor that brings the longer side to 16,384 px and applies it to every position and size, including gap and padding, so the arrangement is preserved exactly at a smaller scale.
Practical Examples
Ten tall screenshots
Ten 1170 × 2532 px phone captures stacked would be 25,320 px tall. The layout is scaled by 0.647 to 757 × 16,384 px, and a notice reports the reduction to 65%.
Common Mistakes & Honest Limitations
Mistakes to Avoid
- Expecting match mode to scale to the largest image. It scales to the smallest to avoid enlarging anything.
Technical Limitations
- On phones and older devices, memory may run out below the nominal canvas limit. If a very large export fails, combine fewer images or resize them first.