Avoid overwriting using mogrify

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

Avoid overwriting using mogrify

Post by gluontronic »

Hi there,
I need to improve my script.
I have many tif and jpg files in folders

jpgs are already processed tif ones.

I'm okay with Fred's script : mogrify -path . -format jpg -resize 1500x1000\> *.tif
but if one jpg already exist, it is obviously overwritten.

is there a way to rename the new file or whatever to avoid that ?

many thanks
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Avoid overwriting using mogrify

Post by fmw42 »

I use the -path option in mogrify to write all files to a new directory and then if OK remove the old one and rename the new one if needed.

see http://www.imagemagick.org/Usage/basics/#mogrify

In other words cd to the old directory, have a new one ready and put the path to the new one in the -path parameter. That processed the image is the current directory and puts them into the empty new directory.
Post Reply