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)

Comments are closed.

Post a Comment