July 21, 2004
-
A bash script which uses ImageMagick's composite command to add all jpegs in a directory together, leaving behind a trail of huge PNG files for later comparison.
Yes, the previous iteration of this script was crap.
Here's the updated version, for the edification of all:
#!/bin/bash
counter=1
for image in *.JPG
do
if [ ! -e "output$counter.png" ] ; then
echo "addimages: converting $image to output$counter.png"
convert $image output$counter.png
else
# outputimage exists, so we can add to it
let "newcounter = $counter + 1"
echo "addimages: adding $image, output$newcounter.png"
composite -compose Add $image output$counter.png output$newcounter.png
let "counter=$newcounter"
fi
done
Comments (2)
what exactly do you mean by "adding" them together?
Each pixel in the base picture is mathematically added to the same pixel in the source image. Output the result. Repeat for all images.
Comments are closed.