I have a number of photos. I want to add these images togther pixel-wise (not mean or median). I have Imagemagick installed, and I tried:

composite -compose plus IMG* ~/Desktop/sum.png

But the output image

enter image description here

wasn't noticeably brighter than the input images:

enter image description here

Since I have 30 input images, I expected the output to be much brighter.

Why isn't this working, and how do I sum images, using either Imagemagick, or other free tool?

  • As @asalamon74 has pointed out, imagemagick will only merge two images in the way you've described. If you want to merge more, you can write a relatively simple bash script to take in a directory and merge all images through a series of merges. i.e. ((im1 + im2) + im3) + im4 ... – Myridium Feb 16 '17 at 2:32
  • 1
    It's not clear to me what you're trying to achieve, but the free app Star Stax looks like it might do some of what you want. – user1118321 Feb 16 '17 at 3:50

Imagemagick cannot be used to compose 30 images in one step. The documentation states:

Image Composition is the process of merging two (and only two) images in a variety of ways.

The following simple bash script creates a black 100x100 image (temp.png) and compose all the test_*.jpg images (assuming all of them are 100x100) one by one to this image.

convert -size 100x100 canvas:black temp.png
for f in test_*.jpg; do
  composite temp.png "${f}" -compose Plus temp.png
  • Is it possible to merge 32 images in 31 steps? – Crowley Feb 15 '17 at 16:23
  • yes, you can compose 32 images in 31 steps – asalamon74 Feb 15 '17 at 19:19
  • 1
    Added an example – asalamon74 Feb 16 '17 at 12:18
  • 1
    Wouldn't it be better to merge images like in tournament tree? Number of opertaions will be the same but all the images will be used equally. – Crowley Feb 16 '17 at 12:30
  • 1
    I've modified the code to use png temp image – asalamon74 Feb 18 '17 at 7:33

You can use GIMP.

  1. Open the 1st image.

  2. Open the 2nd image as a layer (Ctrl + Alt + O).

  3. Change layer mode to "Addition" (Dialogue - Layers - Mode).

  4. Open next image as a layer.

  5. Change layer mode to "Addition".

  6. Proceed until all images are added.

You can add all images at once (selecting them with Ctrl while opening as a layer) but you'll still have to change layer mode individually for every layer.

This procedure is also possible with any graphic editor which is capable to work with layers (Paint.net, Photoshop (not free!) etc).

  • 2
    Is it not possible to first import all images as layers, and then select all of them at once, right click and choose to change their mode to "Addition"? I'm not familiar with GIMP. This just doesn't seem practical for 30 images. – Myridium Feb 16 '17 at 13:13
  • 1
    No, it's not possible to select multiple layers in GIMP. – Zenit Feb 16 '17 at 13:16

After attempting to apply the repeated composite technique with HDR images and ending up with clamped output, I discovered the -evaluate-sequence operator. Here's an example:

convert *.exr -evaluate-sequence Add output.exr

This takes all the .exr files (or whatever format you want) in the current directory and sums them into a new image, output.exr.

If that doesn't give proper HDR output you may need to ensure you have a version of image magick built with HDR enabled.


Thanks to asalamon74 for a solution using a bash script, which I modified to use PNG rather than JPEG, as szulat suggested.

convert -size 100x100 canvas:black temp.png

for f in IMG_*.jpg; do
  composite temp.png ${f} -compose Plus temp.png

I tested, and this works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.