Merging eleven images into one canvas is not a tidy join. It is a new file that is larger than all inputs combined, padded with background pixels, stripped of animation, flattened to 8-bit, and missing any file that would not decode.
The horizontal canvas was 22,128 × 4,000, 88,512,000 pixels, but only 69.968% of them held image content. The PNG output was 52,254,111 bytes, 2.496 times the input total. The JPEG was 12,515,415 bytes, smaller than the inputs but re-encoded at quality 90. A 16-bit PNG dropped to 256 levels. A six-frame GIF contributed one frame. One truncated JPEG was silently skipped. Deterministic across runs: SHA-256 5fc11e5a88bb2789 twice.
This page is about what happens to the files, not about which layout to pick. For single-file operations that do not create a new canvas, the batch grayscale measurement and the batch invert measurement used the same twelve files. Yesterday's grayscale run dropped 40.514% of the batch's bytes; today's merge adds bytes, sometimes more than doubles them, because the canvas is a new image that contains all inputs plus padding.
Twelve files, 63,016,384 pixels across the eleven that decoded: six JPEGs (one truncated), four PNGs, one six-frame GIF, one lossy WebP. Each readable file was loaded, converted to RGBA for compositing, and pasted onto a white canvas in three layouts: horizontal (side by side, sorted by height descending, centered vertically), vertical (stacked, sorted by width descending, centered horizontally), and grid (3 columns × 4 rows, 500×500 cells, each image scaled via thumbnail preserving aspect ratio). Each canvas was saved as PNG and as JPEG quality 90, then reopened from disk and measured.
Three things are counted separately because mixing them is how misleading numbers get published. Canvas pixels is the total area of the output image. Content pixels is the subset that holds actual image data rather than background fill. Input pixels is the sum of the decoded areas of all contributing files. Canvas is always larger than content, and content is always smaller than the sum of inputs, because pasting an image onto a larger canvas does not copy its neighbor's empty space.
Image.new("RGBA", ...) + Image.paste(img, offset, mask=img). The run used Pillow 13.0.0, numpy 2.5.4 and Python 3.13.14 on local files.The same eleven images, merged three ways, produced three outputs that share nothing but their content pixels. The horizontal and vertical canvases are nearly the same size (88.5 and 88.9 million pixels), but the grid canvas, where each image was scaled to fit a 500×500 cell, is thirty times smaller.
| Layout | Canvas size | Canvas pixels | PNG bytes | JPG bytes | Bg % | Unique colors |
|---|---|---|---|---|---|---|
| Horizontal | 22128×4000 | 88,512,000 | 52,254,111 | 12,515,415 | 30.032% | 942,810 |
| Vertical | 4000×22228 | 88,912,000 | 61,828,569 | 12,211,563 | 30.347% | 942,810 |
| Grid (500px cells) | 1500×2000 | 3,000,000 | 1,882,313 | 416,179 | 49.084% | 289,682 |
Background percentage is the share of canvas pixels that are pure white fill, not image content. Horizontal and vertical have the same 61,929,833 content pixels because the same eleven images are pasted; the layouts only differ in how the empty space is distributed. The grid has fewer content pixels because thumbnail scaling reduced each image before pasting.
The horizontal PNG is 2.496 times the input total. The vertical PNG is 2.953 times. Both are larger than the sum of their inputs because PNG stores the full canvas losslessly, and the canvas is bigger than the inputs. The JPEG outputs are smaller than the input total because JPEG compresses photographic content more efficiently than PNG, and the inputs include a 10.6 MB PNG that becomes part of a 12.5 MB JPEG.
The grid tells a different story. By scaling each image to fit a 500×500 cell first, the canvas shrinks to 3,000,000 pixels, and the PNG output is 8.991% of the input byte total. The trade-off is that nearly half the canvas, 49.084%, is background fill, because most images do not fill a square cell after preserving their aspect ratio.
This is the part no merge tool mentions. Eleven images totaling 63,016,384 pixels produce a canvas of 88,512,000 pixels. The difference, 26,582,167 pixels, is pure background. It exists because images have different heights, and the canvas must accommodate the tallest one across its full width.
The math is simple. In horizontal mode, canvas width is the sum of all image widths, and canvas height is the maximum image height. Any image shorter than the maximum leaves a gap. In our batch, the tallest images are 4,000 pixels, but the shortest is 128 pixels. A 128×128 icon pasted into a 4,000-pixel-tall row contributes 128×128 = 16,384 content pixels and leaves 128×3,872 = 495,616 background pixels. The icon's own content is 3.2% of its allocated column.
Vertical stacking has the same problem rotated. Canvas width is the maximum image width, and any narrower image leaves horizontal gaps: 26,982,167 background pixels, 30.347% of its 88,912,000-pixel canvas. The grid layout compounds the waste because each cell is a fixed square and most images are not square: 1,527,466 pixels held content, 1,472,534 did not.
Three layouts, the same eleven images. The grid wastes the most canvas proportionally, but its absolute canvas is thirty times smaller.
The 1200×800 RGBA PNG had 607,580 fully transparent pixels and 352,420 fully opaque ones, 63.29% of the image transparent. Those pixels held no color, only an alpha value of zero. When the logo was pasted onto a white RGBA canvas using its own alpha as a mask, the transparent pixels became white.
This is not a bug. Image.paste(src, box, mask=src) composites the source onto the destination using the source's alpha channel. Where the source is transparent, the destination shows through. The destination was white, so white shows through. Whatever RGB values sit underneath those transparent pixels never reach the canvas.
Saving the same logo on a transparent canvas (RGBA with alpha zero for the background) preserved the 607,580 transparent pixels. That file was 7,806 bytes. The white-background version was 7,225 bytes. The transparent version is 8.042% larger because PNG must store an alpha channel for every pixel, even ones that are fully transparent. Both versions had exactly two distinct RGB colors in the non-transparent regions.
Saving the merged canvas as JPEG removes the question entirely. JPEG has no alpha channel. A transparent canvas saved as JPEG will be filled with a background color, usually black or white depending on the encoder, before encoding. In our measurement, converting the RGBA canvas to RGB before JPEG save filled transparent areas with black (0, 0, 0) because the RGB values under the alpha were zero in the transparent canvas.
| Background | PNG bytes | JPG bytes | Transparent pixels remaining |
|---|---|---|---|
| White (255,255,255) | 7,225 | not tested separately | 0 (all became white) |
| Transparent (0,0,0,0) | 7,806 | n/a (JPEG has no alpha) | 607,580 |
The byte difference between transparent and white PNG is 581 bytes, 8.042% larger for transparent. The transparent version must encode an alpha plane that the white version does not need once the background is uniform.
The 800×600 grayscale PNG was stored in mode I;16, meaning each pixel was a 16-bit integer from 0 to 65,535. The file had exactly 65,536 unique sample values, the full range, and was 12,042 bytes on disk.
To paste it onto an RGBA canvas, Pillow converted it to RGBA, which holds 8 bits per channel. That conversion collapsed 65,536 levels into 256: the merged canvas holds values from 0 to 255. The reduction is 99.609%, and it is permanent. The original 16-bit depth is not in the canvas, not in the saved PNG, and not recoverable from the merged output.
We did not test how the merged file responds to later tone adjustments, so we make no claim about when banding becomes visible. The measurable fact is the level count: 65,536 before the merge, 256 after it.
The 400×300 GIF had six frames. Frame zero was in palette mode P, and frames one through five were in RGB. When loaded for compositing, only frame zero was read. The other five frames were not placed on the canvas.
This is not a setting you can toggle. A merge canvas is a single still image. It has one set of pixels, not six. An animated GIF is a sequence of frames that play over time; a merged image is one frame that does not. The merge operation is not a frame-averaging operation or a frame-stacking operation. It takes frame zero and discards the rest.
If the animation matters, the merge tool should either warn you or offer to extract each frame as a separate image before merging. Ours did neither, which is the default behavior of most merge tools that accept GIF as an input format without mentioning what they do with it.
The twelfth file was a 1,200-byte JPEG claiming to be 3000×4000 pixels. It failed to load with the error image file is truncated (2 bytes not processed). The merge completed with eleven images instead of twelve.
No warning was produced. The canvas was created, the eleven readable images were pasted, the output was saved, and the broken file was not on it. If you merge a hundred images and three are corrupt, you get a canvas with ninety-seven images and no indication that three are missing. The gap is not a blank space on the canvas; it is an absence that the canvas dimensions do not reveal, because the canvas size is computed from the images that loaded, not from the files that were submitted.
Loading eleven images took 930.05 ms. The horizontal merge, including paste and save as both PNG and JPEG, took 8,680.91 ms. The vertical merge took 10,037.43 ms. The grid merge with thumbnail scaling was fastest at 1,160.22 ms, because the canvas was thirty times smaller. The total run, all three layouts, was 20,808.60 ms.
The horizontal merge was run twice and both outputs were saved as PNG. The SHA-256 of both files was 5fc11e5a88bb2789, identical. The merge is deterministic: same inputs, same order, same canvas, same bytes.
| Phase | Time (ms) | Share of total |
|---|---|---|
| Load all 11 images | 930.05 | 4.470% |
| Horizontal merge + save | 8,680.91 | 41.718% |
| Vertical merge + save | 10,037.43 | 48.237% |
| Grid merge + save | 1,160.22 | 5.576% |
| Total | 20,808.60 | 100% |
Timing includes open, load, convert to RGBA, paste, save as PNG, convert to RGB, save as JPEG quality 90. Color census and determinism re-run are excluded. The grid merge is fast because its canvas is 3,000,000 pixels, not 88,000,000.
The eleven input images contained 2,979,992 unique RGB triples in total. The horizontal merged canvas held 942,810. That is 31.638% of the input sum, not because colors were lost but because many inputs shared colors. The two byte-identical portrait JPEGs contributed the same 597,567 colors twice. The 16-bit PNG and the 8-bit grayscale JPEG both mapped to 256 gray levels. The logo and the animation contributed 3 and 2.
The grid canvas held 289,682 colors, fewer than the horizontal or vertical, because thumbnail scaling quantizes. Each image was reduced to fit a 500×500 cell, which means fewer pixels and therefore fewer distinct colors. The reduction is not uniform: a 3000×4000 JPEG (12,000,000 pixels) scaled to 375×500 (187,500 pixels) loses 98.438% of its pixels, but its unique color count drops from 597,567 to whatever fits in 187,500 pixels.
The merge does not create new colors. It collects the ones already present, minus what thumbnail scaling removes.
Three small images (the GIF, the 16-bit PNG, and the 128×128 icon) were merged side by side on three different backgrounds: white, black, and transparent. The outputs were nearly identical in PNG byte size, because the background is a uniform color that PNG compresses to almost nothing regardless of which color it is.
| Background | PNG bytes | JPG bytes |
|---|---|---|
| White (255,255,255) | 33,935 | 23,105 |
| Black (0,0,0) | 33,901 | 20,974 |
| Transparent (0,0,0,0) | 33,941 | n/a |
The transparent PNG is 6 bytes larger than the white PNG and 40 bytes larger than the black, because the alpha channel adds a plane. The black JPEG is 9.223% smaller than the white JPEG because black backgrounds compress better in JPEG's DCT coefficients. The transparent background cannot be saved as JPEG because JPEG has no alpha channel.
The batch was merged on a local machine with Pillow. A browser-based merge tool running in JavaScript will produce different timings and possibly different byte counts depending on its canvas implementation and JPEG encoder. The broken-file behavior (silent skip) is specific to Pillow's Image.open; a tool that uses createImageBitmap in the browser may handle truncation differently. The background fill color was white (255, 255, 255) for the main measurement; a tool that defaults to a different fill will produce different alpha compositing results. We did not test merging images with identical dimensions, where background waste would be zero. We did not test overlapping or layered merges, only non-overlapping paste. The grid layout used Pillow's thumbnail method, which uses box-filter resampling; other resampling methods would produce different byte counts and color counts.
Yes, but the canvas grows with every file you add, and the files do not all arrive. In our run eleven images went onto one horizontal canvas of 22,128 x 4,000 pixels, 88,512,000 pixels total. 30.032% of that canvas was background fill created by unequal image heights. One of the twelve submitted files was a truncated JPEG that failed to decode, so eleven appeared and no warning was produced. Count what you put in and count what actually landed.
The canvas is always larger than the sum of the input pixels. In our eleven-file horizontal merge, the inputs totaled 63,016,384 pixels but the canvas was 88,512,000 pixels. The 26,582,167 extra pixels, 30.032% of the canvas, were background fill. Vertical stacking was worse at 30.347%. Grid layout with thumbnails wasted 49.084%. Every image with a different height (or width, in vertical mode) creates a strip of empty canvas next to it.
It depends on the output format and the background fill. Our transparent logo had 607,580 fully transparent pixels out of 960,000, 63.29% of the image. When pasted onto a white canvas, those pixels became white. When pasted onto a transparent canvas and saved as PNG, they stayed transparent but the file was 8.042% larger (7,806 bytes versus 7,225 bytes). Saving as JPEG removes alpha entirely, because JPEG has no alpha channel.
Only the first frame participates. Our 400x300 GIF had six frames, each in mode P or RGB. After loading and converting to RGBA for compositing, only frame zero was placed on the canvas. Five frames were lost. The merged output is a single still image, not an animation.
It depends on the output format and whether images were scaled. Our horizontal merge produced a 52,254,111-byte PNG, 2.496 times the 20,934,926-byte input total. The JPEG version was 12,515,415 bytes, 59.782% of the input total. The grid merge with thumbnails was 1,882,313 bytes PNG, 8.991% of the input total, because each image was scaled down to fit a 500x500 cell first.
No. Our 800x600 16-bit grayscale PNG had 65,536 unique sample values from 0 to 65,535. When loaded for compositing it was converted to RGBA, which is 8-bit per channel. The merged canvas holds 256 values from 0 to 255, a 99.609% reduction in available levels. The original 16-bit depth cannot be recovered from the merged output.
It is silently skipped. Our truncated JPEG, 1,200 bytes for a file claiming 3000x4000 pixels, failed to load with the error image file is truncated (2 bytes not processed). Eleven of twelve files were merged. The broken file contributed nothing to the canvas. A merge tool that does not report the skip will produce a canvas with a missing image and no warning.
Related measurements on the same twelve files: what one grayscale button does to a batch (bytes dropped 40.514%, nine files became single-channel), what one invert button does to a batch (a reversible operation that still changes bytes), and what one rotate button does to a batch (some files kept EXIF, some did not). For combining images two at a time, the batch flip page covers a different operation on the same concept of one button applied to many files.