Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ImageMagick Question
#2
More a shell question. Your file pattern makes one singe call to  compose see all the files. There is a specific syntax in IM to tell it to loop over files but this is complicated and in Linux (if I trust your profile) its a lot simpler to use the regular shell syntax. Try something like:
Code:
for f in *alpha.jpg; do b=$(basename $f _alpha.jpg); composite -compose $b.jpg ${b}_alpha.jpg $b.png;done

(one-liner for a command line, or in a script:

Code:
for f in *alpha.jpg
do
    b=$(basename $f _alpha.jpg)
    composite -compose $b.jpg ${b}_alpha.jpg $b.png
done

In slo-mo:
  • for f in *alpha.jpg: will loop over all the  *alpha files. Looping on the others is complicated because the simple pattern frame*.jpg will include both the "plain" files and the "alpha" ones.
  • b=$(basename $f _alpha.jpg) extracts the base name of the file, and drops the _alpha.jpg termination if present, so tiu are left with frame_000000xxx.
  • composite -compose $b.jpg ${b}_alpha.jpg $b.png calls the command, and $b or ${b} is replaced by the frame_000000xxx obtained above. ${b} is necessary when appending _alpha because with $b_alpha the shell would be looking for a variable named $b_alpha since the underscore can be used in variable names.
Reply


Messages In This Thread
ImageMagick Question - by Tas_mania - 01-21-2019, 02:11 AM
RE: ImageMagick Question - by Ofnuts - 01-21-2019, 07:26 AM
RE: ImageMagick Question - by Tas_mania - 01-21-2019, 10:45 AM
RE: ImageMagick Question - by Ofnuts - 01-21-2019, 01:35 PM
RE: ImageMagick Question - by Tas_mania - 01-22-2019, 12:15 AM
RE: ImageMagick Question - by Tas_mania - 01-23-2019, 12:44 AM
RE: ImageMagick Question - by Tas_mania - 01-28-2019, 11:01 PM
RE: ImageMagick Question - by Ofnuts - 01-29-2019, 01:03 AM
RE: ImageMagick Question - by Tas_mania - 01-29-2019, 10:32 PM
RE: ImageMagick Question - by Ofnuts - 01-29-2019, 11:29 PM
RE: ImageMagick Question - by rich2005 - 01-30-2019, 10:03 AM
RE: ImageMagick Question - by Tas_mania - 01-31-2019, 09:32 AM

Forum Jump: