Page 1 of 1

Really simple question please help! (Windows OS)

Posted: 2011-11-18T04:33:43-07:00
by liltbrockie
Hi there! I'm sure this is a really simple question but after about 2 hours of reading examples and trying to find someone thats trying to do the same thing I admit defeat!!

Trying to resize images from c:\images to c:\images\done and keep the original filename

Got as far as convert c:\images\*.* resize 250x250 c:\images\done\

and that just gives me a load of filenames 0.jpg 1.jpg etc etc

please please please can i have it keep the original filename :-(

EDIT: actually i just thought i need 2 other different sizes produced at the same time. with "_t" and "_s" suffixed .. i can do this with the write command right? how?

EDIT 2: Getting somewhere now....

Code: Select all

mogrify -format jpg -path images/done/ -resize 250x250 images/*.jpg
Just need to write 2 other files at the same time with 2 different suffixes?

Re: Really simple question please help! (Windows OS)

Posted: 2011-11-19T03:02:13-07:00
by whugemann
You can do this in FOR loop. You can find sample code on the webpage mentioned below. The DOS command is

FOR %i in (*.*) DO convert "%i" -resize 250 "done\%i"

The quotes will guarantee that this also functions with blanks in filenames or path.

In a batch file, the percent signs must be doubled:

FOR %%i in (*.*) DO convert "%%i" -resize 250 "done\%%i"

Different sizes can be achieved in two runs:

FOR %%i in (*.*) DO convert "%%i" -resize 250 "done\%%~ni_s%~xi"
FOR %%i in (*.*) DO convert "%%i" -resize 500 "done\%%~ni_t%~xi"

or

FOR %%i in (*.*) DO (
convert "%%i" -resize 250 "done\%%~ni_s%~xi"
convert "%%i" -resize 500 "done\%%~ni_t%~xi"
)

In case that you are dealing with JPEGs, you should better choose the dimension to be a multiple of 8 or even 16.

Re: Really simple question please help! (Windows OS)

Posted: 2011-11-21T00:49:27-07:00
by liltbrockie
Thank you so much! You forgot the double % at the end there ;-)

Seriously thanks thanks a lot!!!!!!!!!!