Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Imagemagick convert and compose batch of files

I am trying to make a fast convert of a batch of files like this:

convert ./src/*.png -set filename: '%t' -gravity West -draw 'image over 0,0 424,600 "./panel.png"' ./dest/%[filename:].png

which is pretty similar to COMPOSITE:

convert ./src/*.png ./panel.png -set filename: '%t' -gravity +0+0 -composite ./dest/%[filename:].png

except the last one is not working and just making one first crappy-looking file. Looks like it's bug?

Does anybody know how to make it more correct with -composite? for|awk|ls|find for each file in shell is not acceptable - because that is slower than the first example.

like image 817
nvvetal Avatar asked Dec 11 '25 17:12

nvvetal


1 Answers

  • Read in the list of files,
  • set their output filenames,
  • include the IM special image placeholder "null:",
  • read in your overlay image,
  • optionally, set the geometry,
  • and composite that overlay onto all the other images with "-layers composite".

That null: separates the original input file list from the overlay image so ImageMagick knows where in the stack you want to start doing the composite.

Try something like this (one step per line for readability):

convert ./src/*.png \
    -set filename: '%t' \
    null: \
    ./panel.png \
    -layers composite ./dest/%[filename:].png
like image 167
GeeMack Avatar answered Dec 14 '25 09:12

GeeMack



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!