If instead of using XCF you use PNG, you can use ImageMagick's convert command in a Bash shell script (ie, the "Terminal" on OSX), then the whole thing becomes:
And you call it it as:
Code:
#! /bin/bash
botDir=$1
midDir=$2
topDir=$3
outDir=$4
function rootName {
echo $(basename "${1%%.*}")
}
for bot in $botDir/*.png
do
for mid in $midDir/*.png
do
for top in $topDir/*.png
do
out="$outDir/$(rootName "$bot")-$(rootName "$mid")-$(rootName "$top").png"
printf "Generating %s\n" "$out"
convert "$bot" "$mid" -composite "$top" -composite "$out"
done
done
done
Code:
./generate /path/to/bottomDir /path/to/middleDir /path/to/topDir /path/to/outDir
PS:
- Code above would also work for XCF (with appropriate .png ➤ .xcf changes) , but you have to make sure that your version of ImageMagick handles the XCF format (which likely means to make sure that the XCFs are in the 2.8 format)
- With some recent versions of ImageMagick convert has become magick convert