Recursive compositing
Posted: 2012-03-06T12:38:37-07:00
Using a glob I'm trying to repetitively composite two files, files that are named identically but reside in different folders: "Old" and "New". E.g.:
New/image1.png
Old/image1.png
Using a glob on the first input file and an explicit file name on the second this command would work fine:
convert Old/*.png -set filename:nameroot '%t' New/image1.png -composite 'OutFolder/%[filename:nameroot].gif'
I want to fill the folders with pairs of files and want a composite out of each: E.g.:
New/image1.png and Old/image1.png would composite to OutFolder/image1.gif
New/image2.png and Old/image2.png would composite to OutFolder/image2.gif
New/image3.png and...
If I could use the filename % escape in the second input filename something like this pseudo code might work:
convert Old/*.png -set filename:nameroot '%t' 'New/%[filename:nameroot].png' -composite 'OutFolder/%[filename:nameroot].gif'
This doesn't work for at least two reasons:
1. The *.png glob would capture everything into a long list of files that would be composited. We just want one file pair composited at a time.
2. A filename % escape (%[filename:nameroot]) is designed only to work on the output filename, not an input filename.
Is there any way to do this sort of recursive compositing in a single command?
New/image1.png
Old/image1.png
Using a glob on the first input file and an explicit file name on the second this command would work fine:
convert Old/*.png -set filename:nameroot '%t' New/image1.png -composite 'OutFolder/%[filename:nameroot].gif'
I want to fill the folders with pairs of files and want a composite out of each: E.g.:
New/image1.png and Old/image1.png would composite to OutFolder/image1.gif
New/image2.png and Old/image2.png would composite to OutFolder/image2.gif
New/image3.png and...
If I could use the filename % escape in the second input filename something like this pseudo code might work:
convert Old/*.png -set filename:nameroot '%t' 'New/%[filename:nameroot].png' -composite 'OutFolder/%[filename:nameroot].gif'
This doesn't work for at least two reasons:
1. The *.png glob would capture everything into a long list of files that would be composited. We just want one file pair composited at a time.
2. A filename % escape (%[filename:nameroot]) is designed only to work on the output filename, not an input filename.
Is there any way to do this sort of recursive compositing in a single command?