convert + resize tif to jpeg for a LOT of folders/subfolders

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
gluontronic
Posts: 3
Joined: 2013-01-13T13:58:06-07:00
Authentication code: 6789

convert + resize tif to jpeg for a LOT of folders/subfolders

Post by gluontronic »

Hi there,
I read this one: viewtopic.php?f=1&t=19198

I have many folders + subfolders.
I want to:
- resize all tiffs that are greater than 1500 for width and/or 1000 for height
- convert all tiffs to jpeg with a specific quality factor

I want to do that in-place (I have backups in case of problem)
I don't want to convert other files in these folders (sometimes I have some png and jpeg)

Do I have to use mogrify ?
I read this http://www.imagemagick.org/Usage/basics/#mogrify_not and I don't really know if I HAVE to use mogrify in my case or not.

Does someone would help me with the ImageMagick/Mogrify parameters part (conditional resize + conversion) ?

ANY leads or help would be very appreciate.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert + resize tif to jpeg for a LOT of folders/subfol

Post by fmw42 »

mogrify -path path2/folder -format jpg -resize 1500x1000\> *.tif *.tiff

This is for unix. In windows you may have to


mogrify -path path2/folder -format jpg -resize "1500x1000>" *.tif *.tiff

The only other way is to write a script to convert images one-by-one by using a loop over all files in each directory you want.
gluontronic
Posts: 3
Joined: 2013-01-13T13:58:06-07:00
Authentication code: 6789

Re: convert + resize tif to jpeg for a LOT of folders/subfol

Post by gluontronic »

Hi Fred,
many thanks for your command.
I read about memory problem if we want to do that recursively in MANY folder + subfolders.
any point of view about that ?

is it possible to make a script with a loop to do that? the question is: to let mogrify make the loop or the shell..
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert + resize tif to jpeg for a LOT of folders/subfol

Post by fmw42 »

gluontronic wrote:Hi Fred,
many thanks for your command.
I read about memory problem if we want to do that recursively in MANY folder + subfolders.
any point of view about that ?

is it possible to make a script with a loop to do that? the question is: to let mogrify make the loop or the shell..
You can combine the two. Make a list of all your directories, loop over each one and use mogrify to process all the images in the directory.
Post Reply