Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automated batch xcf layer combining and png exporting
#3
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:

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
And you call it it as:
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
Reply


Messages In This Thread
RE: Automated batch xcf layer combining and png exporting - by Ofnuts - 09-05-2021, 09:08 AM

Forum Jump: