On the other hand, there is the ability to put %d or something like %5d in an output filename, which just inserts sequential numbers for multiple output files (assuming the output format isn't just able to pack several images into the same file).
In an output filename you can also refer to %[xxx] to refer to something set using -set, but you can't e.g. use %[t] or %t directly to refer to the input filename (instead you just get a literal %[t] in the output filename). Instead examples suggest you must do something like
Code: Select all
convert infile*.jpg -set filename: %[t] (tranformations) output%[filename:].jpg
It also isn't clear from the examples if there is something magical about the name 'filename' or the presence of the colon.
These two uses seem to be separate but somehow related and I can't find any clear explanation. The only mention of using %d to get sequentially-numbered output files is in the Output Filename section of the main Command Line page at https://imagemagick.org/script/command- ... php#output and there does not seem to be any link from this tutorial/example styled page to a formal description of this feature.
The page (https://imagemagick.org/script/escape.php) describing the Percent Escape Sequences states "You can utilize percent escapes in a number of options, for example..." which sounds like there is a specific but nowhere near universal set of contexts where they can be used but I could not find any definitive list of such contexts. If they can actually be used in any non-keyword part of a command line (except, clearly, output filenames), this wording is confusing.
So I guess I'm seeking some clarification on what things with percent-escape-like syntax can be used in output filenames, and what do they mean? Can %x be used to get sequential numbers in hexadecimal? Why can %[blart] in an output filename refer to a -set value but not to %[t] %t or %[basename]? A better and more complete description (rather than just a couple of examples) of contexts where Percent Escape Sequences can be used would also be useful.
More pawing through the help found, under the documentation for "-set", the statement
. So, yes, there is something magical about the word 'filename'. Again, that "some xxx do something, for example yyy" with no reference to a definitive list of the special cases. Well, gosh, it would be really nice if this were stated somewhere a little more obvious, like on the Percent Escape Handling page, or where output filenames and their peculiar use of %d are described...Some 'properties' must be defined in a specific way to be used. For example only 'properties' prefixed with "filename:" can be used to modify the output filename of an image
And although "filename" is an artifact (as shown using Identify -verbose) containing the filename, trying to refer to it in the output file without using -set first clearly doesn't expand anything either; I ended up with a single output file called "blart%[filename" which contained 6 windows file system streams called "]-0.jpg" "]-1,jpg" and so on. Now that's confusing (even though I'm well aware of windows file streams).