use mogrify on folder with multiple image formats?

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
josephaaroncampbell
Posts: 40
Joined: 2015-07-14T19:18:45-07:00
Authentication code: 1151
Location: Chicago, IL

use mogrify on folder with multiple image formats?

Post by josephaaroncampbell »

Hello!

So I know how to use the following command to batch convert a folder of images:

mogrify -format jpeg *.png

But what if the folder of images I want to convert also has '.tif' or '.dng' included as well? Is there another option for ' *.png " that will include any file type? tried the following but it just throws a couple errors:

' mogrify -format jp2 *.png *.tif *.dng' ??

-error unable to open image '*tif': Invalid argument @ error/blob.c/OpenBlob/2697
-error unable to open image '*dng': Invalid argument @ error/blob.c/OpenBlob/2697
-no decode delegate for this image format '' @ error/constitute.c/ReadImage/501


Thank You!

using ImageMagick-6.9.1-Q16-HDRI
windows 7 64 bit
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: use mogrify on folder with multiple image formats?

Post by fmw42 »

use * at the end to process all files

Code: Select all

mogrify -format jp2 *
but I urge you to save to a different folder using -path option so you do not overwrite your input images in case of error.

This also works for me to just process png and tif

Code: Select all

cd /Users/fred/desktop/test1
mogrify -path ../test2 -format jpg '*.png' '*.tif'

josephaaroncampbell
Posts: 40
Joined: 2015-07-14T19:18:45-07:00
Authentication code: 1151
Location: Chicago, IL

Re: use mogrify on folder with multiple image formats?

Post by josephaaroncampbell »

Thank You fmw42! this worked just as I needed it to. The path was something on my list to add so thank you for that information as well.
Post Reply