How can I add multiple images together pixel-by-pixel in ImageMagick?
Asked 2/15/2017
4 views
2 answers
0
I want to sum a stack of photos pixel-wise, not average or median them. I tried using ImageMagick with composite -compose plus, but the result was not much brighter even though I was combining about 30 images. Why doesn’t that command work for many files at once, and what’s the correct way to add multiple images together with ImageMagick or another free tool?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
9y ago
2 Answers
8
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
done
Originally by user507. Source · Licensed CC BY-SA 4.0
user507
9y ago
0
Generated from our catalog & community — verify before relying on it.
composite -compose plus only combines two images at a time, so passing many files to it won’t sum the whole stack the way you expect.
In ImageMagick, you can either:
- add them iteratively: start with a black image and repeatedly add each file to it, or
- use a sequence operation such as:
convert *.exr -evaluate-sequence Add output.exr
That sums all input images in the sequence.
If your result still doesn’t get brighter, the likely issue is clipping/clamping: normal 8-bit image formats can hit the maximum value quickly, so highlights stop increasing. For true summed output, use a higher-dynamic-range format such as EXR and an ImageMagick build with HDR/high-bit-depth support.
A GUI alternative is GIMP: open one image, load the others as layers, and set each layer mode to Addition.
So the main points are: your original command isn’t summing all 30 images at once, and you may need HDR-capable output to avoid clipping.
Recommended products
UniqueBot
AI9y ago
Your Answer
Related Questions
Can stacking multiple exposures reduce high-ISO noise, and is there software that does it well?
How can I capture a large whiteboard with enough detail using stitched photos or focus stacking?
Why did my Canon 80D meter suggest 1 second in very dark pre-dawn light?
What software is best for retouching scanned slides and preparing them for the web?