Mogrify - Specify Input Folder

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
pjvedder
Posts: 12
Joined: 2011-06-22T12:39:02-07:00
Authentication code: 8675308

Mogrify - Specify Input Folder

Post by pjvedder »

This may be a stupid question, so I apologize in advance... I couldn't find it anywhere in the documentation, but how do you specify which folder's images you want mogrify to process? I'm running ImageMagick through coldfusion, so this is my mogrify call:

Code: Select all

<cfexecute name="C:\Program Files\ImageMagick-6.7.0-Q16\MagickCMD.exe"
arguments='mogrify -format jpg *.eps'
timeout="5000"
variable="debugReport"
/>
I saw there was an option called "-path" where I believe it specifies the output, but what about input? When I ran the above code as is, I couldn't get it to process any images, no matter where I placed them (in the ImageMagick folder, in the folder where the script is run, etc.)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mogrify - Specify Input Folder

Post by fmw42 »

you have to cd to the folder you want to process and use -path for the folder to place the output images if other than the current folder.
pjvedder
Posts: 12
Joined: 2011-06-22T12:39:02-07:00
Authentication code: 8675308

Re: Mogrify - Specify Input Folder

Post by pjvedder »

I don't think I can do that in ColdFusion. There's no way to cd to a directory, as far as I know.. ColdFusion doesn't work like that.

I'm pretty surprised mogrify doesn't have an path or folder input option/parameter. It seems like it makes mogrify basically unusable when executing an IM script from ColdFusion. Now I just have to hope a large loop with a ton of converts doesn't make me run out of memory.

Thanks for you help, though.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Mogrify - Specify Input Folder

Post by anthony »

You can specify the input path as part of the image read.

mogrify -format jpg -path output_folder/ input_folder/*.eps
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mogrify - Specify Input Folder

Post by fmw42 »

I stand corrected. Learned something new today!
pjvedder
Posts: 12
Joined: 2011-06-22T12:39:02-07:00
Authentication code: 8675308

Re: Mogrify - Specify Input Folder

Post by pjvedder »

Works like a charm! Thanks!!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Mogrify - Specify Input Folder

Post by anthony »

I thought it was so obvious that I had even thought to put it in the IM Examples.

Basically the -path setting in "mogrify" replaces any input directory component of the input file.
If not given the normal input directory is left as is.

Similarly -format replaces the suffix and codec component of the input file.

I plan to look at more specific -set options for use in "convert" in the IMv7, command line overhaul what do similar things to the 'saved' filename. These 'settings are currently accessible in "convert" using %{single letter} options, but -set does not let you 'set' them :-(
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply