# How to Equally Blend Multiple Images in GIMP

Warning! Some information on this page is older than 3 years now. I keep it for reference, but it probably doesn't reflect my current knowledge and beliefs.

19:55
Sun
01
Aug 2010

How to Equally Blend Multiple Images in GIMP

During my today's walk on Warsaw I took many different photos. Some of them were series of photos of a road from exactly same place, with a purpose of merging them together into a single photo. My idea was to just average the color of each pixel, so it should be like:

`out = 1/4 * (img[0] + img[1] + img[2] + img[3])`

But how to do this in GIMP? There is no such filter AFAIK. An obvious solution is to use blending - Mode and Opacity settings for layers - but it turns out to be not so simple. Each layer blends with a merged image from beneath it, so instead of average formula above we have to refer to a formula for blending (linear interpolation), which is:

`out[i] = t[i] * img[i] + (1-t[i]) * out[i+1]`

Where:
i is a layer index 0..(n-1), indexed from the topmost layer,
t[i] is Opacity parameter for layer i.

After expanding it for 4 layers, the formula becomes:

`out =t[0] * img0 + (1-t[0]) * (  t[1] * img1 + (1-t[1]) * (    t[2] * img2 + (1-t[2]) * (      t[3] * img3 + (1-t[3]) * 0    )  ))`

Finally, after doing some math with pen and paper, I calculated that to equally blend (average) n images in GIMP, you should:

• Load all the images as layers - File / Open as Layers.
• Use default blending mode - "Normal".
• Set Opacity for subsequent layers, beginning from the topmost layer, to: 1/n, 1/(n-1), 1/(n-2), ..., 1 percent.

For example, I have 5 photos so I give them Opacity: 20, 25, 33, 50, 100. Here is the result: an image that could be called "Road of Ghosts" :)

By the way, I've found a website where panorama photos can be uploaded for free and interactively viewed using just Flash. Here is my profile: reg | Panogio.