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

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

2. Step 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. Step We need a thumbs folder and I want all images copied there automatically!

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

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

set thumbDIR=%CD%\thumbs\

5. Step 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. Step 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. Step The switch /run makes the Image Resizer process the images immediately. If you first want to review everything, you can remove that switch

8. Step 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 - please link back and give credits
set basedir=%CD%
mkdir "thumbs"
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

Published: Friday, December 30th, 2011 Last Modified: December 30, 2011

Related Posts

Rate This Article
5 of 5 0 (100%) 2 votes