twn wrote:Though this is a bit unrelated to this thread (though very tied to how I'm using it), do you know of a way to do a batch convert of files in imagemagick? I don't mean in a for loop or using something like gnu parallel, but I mean internal to imagemagick.
If you're going to run a particular command on all the TIFs in a directory, for example, you can use wildcards in the command something like this...
Code: Select all
convert *.tif -set filename:f "%t" -quality 100 "%[filename:f].jpg"
That will process all the TIF files, converting them to JPG files with 100% quality, and keeping the same file name only with a .jpg extension instead of the .tif of the original.
Also, similar to snibgo's suggestion about running many commands from a single file, you can process tens of thousands of images from a text file list if the process will be the same for all of them. The command would look something like this...
Code: Select all
convert @listofimages.txt -set filename:f "%t" -quality 100 "%[filename:f].jpg"
... where "listofimages.txt" is a simple text list of images, one file per line. You will need to put quote marks around the file names if there are spaces in them. The "@" at the beginning of the text file name in the command tells IM to read from that file. You can even use a list of files from many directories and create the output files in those directories if you include full paths in the file names and "-set" the output names using the appropriate formatting escapes
you can find at this link.
Please note, I'm using Windows, so you may need to escape percent signs, brackets, slashes, etc., and/or change double quotes to single quotes to make these work from a *nix command line or script.