How To Resize Images From Command Line (Free Script)


Since AutoHotkey not many people bother writing batch scripts anymore, but often they’re easier to make, like this one to quickly resize images from command line!

image batch resizer

Don’t want to understand this script? Jump directly to download

Writing The Batch Script

Tip: For writing CMD batch scripts, I always use the documentation website http://ss64.com/nt/

1. First of all I downloaded this very cool Light Image Resizer for Windows 7 that provides various command line switches as well

2. After the installation, I opened up notepad++ to start writing the batch

Because I added this script to my context menu, everything will assume to happen in the current directory (CD) working directory.

set basedir=%CD%

3. We need a thumbs folder and I want all images copied there automatically!

mkdir “thumbs”
XCOPY /Y %CD%\*.* %CD%\thumbs\

4. We now set a variable using the set command.

set thumbDIR=%CD%\thumbs\

5. Next, we are going to set the directory for the Image Resizer

set obviousDIR=”C:\Program Files (x86)\ObviousIdea\Image Resizer 4\Resize.exe”

6. Now let’s CD into the “obviousDIR” and run the Image Resizer using a profile that I called 550px. Please keep in mind that you need to create your own profile in Light Image Resizer and then change 550px to your own profile.

CD obviousDIR
%obviousDIR% %thumbDIR% /profile=550px /run

7. The switch /run makes the Image Resizer process the images immediately. If you first want to review everything, you can remove that switch

8. Finally, it would be cool if all of those images are copied to my clipboard (the filenames not the images themselves)

DIR /B /A:-D /O:N | clip

Here’s The Final Batch Script To Resize Images From CMD


# Command Line Image Script Written by windows7themes.net - please link back and give credits
set basedir=%CD%
mkdir "thumbs"
set OLDDIR=%CD%
XCOPY /Y %CD%\*.* %CD%\thumbs\
set thumbDIR=%CD%\thumbs\
set obviousDIR="C:\Program Files (x86)\ObviousIdea\Image Resizer 4\Resize.exe"
CD obviousDIR
%obviousDIR% %thumbDIR% /profile=550px /run
CD basedir
DIR /B /A:-D /O:N | clip

As you can see, we only need a few lines of code and now have a great script to resize images

Download Script

We prepared a little .bat file that you may use. If you repost it on another site, please give us credit and link to the article not the download itself or it will be removed.

Download Image Resize Batch Script


Or you might like these sexy wallpaper, tweaks and themes:

Written by oliversk Friday, December 30th, 2011

Was it helpful? Please bookmark it and spread the word

delicious   facebook   google   twitter  

You love Windows, Gaming and everything digital? Great, we too! We have thousands of great Windows 7 themes, registry tweaks, tutorials, so please use our search box if you look for anything specific. If you have some awesome desktop themes, tips or want to write for us, then drop us a mail: win7themes at googlemail.com

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>