convert multiple files and save to a new directory

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
davidrhicks
Posts: 4
Joined: 2012-10-17T10:03:32-07:00
Authentication code: 67789

convert multiple files and save to a new directory

Post by davidrhicks »

How can I convert multiple files and save them to a new directory with the same name? I'm talking hundreds of files. Here is the gist of what I am trying to do:

convert *.tiff -alpha transparent c:\differentDirectory\*.tiff

I know the syntax above is incorrect, but how do I correct it? Or is that even possible?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert multiple files and save to a new directory

Post by fmw42 »

I do not know that you can have a wild card in both the input or output. There may have been a post by Anthony about that or a possible work around. But the easiest way to do this is to use mogrify. see
http://www.imagemagick.org/Usage/basics/#mogrify

cd path2imagefolder
mogrify -format tiff -alpha transparent *.tiff

Note that will override your input images. So to be safe or to test, use -path

create a new folder, then
cd path2imagefolder
mogrify -path path2newimagefolder -format tiff -alpha transparent *.tiff
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: convert multiple files and save to a new directory

Post by whugemann »

By your notation I assume that you are working on a Windows computer, such that http://www.imagemagick.org/Usage/windows/#for_loops should provide you with the solution.
Wolfgang Hugemann
Post Reply