Really simple question please help! (Windows OS)

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
liltbrockie
Posts: 2
Joined: 2011-11-18T04:28:39-07:00
Authentication code: 8675308

Really simple question please help! (Windows OS)

Post 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?
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

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

Post 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.
Wolfgang Hugemann
liltbrockie
Posts: 2
Joined: 2011-11-18T04:28:39-07:00
Authentication code: 8675308

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

Post by liltbrockie »

Thank you so much! You forgot the double % at the end there ;-)

Seriously thanks thanks a lot!!!!!!!!!!
Post Reply