I start by making an animated GIF just to use as an example of a multi-layer image with this command...
Code: Select all
magick rose: -duplicate 5 -virtual-pixel tile ^
-distort affine "0,0 0,%[fx:t*h/n]" -set delay 50 -loop 0 animrose.gif
Code: Select all
magick animrose.gif -set filename:f "%[t]_" %[filename:f]%02d.png"
Code: Select all
animrose_%02d00.png
animrose_%02d01.png
animrose_%02d02.png
animrose_%02d03.png
animrose_%02d04.png
animrose_%02d05.png
If I run the same command but put that underscore in the output file name at the end instead of in the "-set filename:f" like this...
Code: Select all
magick animrose.gif -set filename:f "%[t]" %[filename:f]_%02d.png"
Code: Select all
animrose_%02d.00.png
animrose_%02d.01.png
animrose_%02d.02.png
animrose_%02d.03.png
animrose_%02d.04.png
animrose_%02d.05.png
These discrepancies seem to behave differently when using different input and/or output file formats, too. If I start with this multi-layer TIF...
Code: Select all
magick rose: -duplicate 5 -virtual-pixel tile -distort affine "0,0 0,%[fx:t*h/n]" multirose.tif
Code: Select all
multirose_%02d00.png
multirose_%02d01.png
multirose_%02d02.png
multirose_%02d03.png
multirose_%02d04.png
multirose_%02d05.png
Code: Select all
magick rose: -duplicate 5 -virtual-pixel tile -distort affine "0,0 0,%[fx:t*h/n]" pdfrose.pdf
Code: Select all
magick pdfrose.pdf -set filename:f "%[t]" %[filename:f]_%02d.jpg"
Code: Select all
pdfrose_%02d.j00.jpg
pdfrose_%02d.j01.jpg
pdfrose_%02d.j02.jpg
pdfrose_%02d.j03.jpg
pdfrose_%02d.j04.jpg
pdfrose_%02d.j05.jpg