TbcLogTable of ContentsImage Converter
Bulk Jpeg Image Resize Tool

JPEGSize.EXE

Download jpegsize.exe for Windows for free.

Download jpegsize.exe for Mac OS X for free.

(Free version displays our sponsor websites, you may buy Bestcode File Utilities for no-advertisement version of JpegSize)

Bulk Jpeg Image Resizer Tool

Jpegsize is a command line Windows and Mac OS X utility that resizes JPEG images in a given directory. If no parameter is specified, it creates images that are 800 pixels wide, and adjusts height accordingly to keep aspect ratio. This application is useful when you have digital photos with great detail, and you wish to have smaller versions to e-mail friends, post online etc. Using jpegsize, you can easily create smaller versions of ALL of your photos in a directory with a simple command.

For simple cases, you can just copy jpegsize.exe into the directory of your images and double click on it. It will then generate new images [it will never change the originals] that are 800 pixels wide, and usually 600 pixels high (The actual width will depend on hight/width ratio but normally, digital photos from cameras have 4/3 height to width ratio).

Optional parameters are:

-ratio nn     resize image to nn% of the original. For example -ratio 50 means
a new image whose height and width is 50% of the original image.
-height nn     resize image to make its height nn pixels. Width will be automati
cally adjusted to keep aspect ratio.
-width nn     resize image to make its width nn pixels. Height will be automati
cally adjusted to keep aspect ratio.
-srcdir adirectory     directory of the original image files. By default, this
is the current directory.
-destdir adirectory     destination directory to save modified files. By default
, this is the current directory. Destination files have '_s.jpg' appended to the
ir names.
-quality number between 1 to 100. The higher the number, the better the image quaility, but larger the file size. Default is 80. (MacOS version does not support -quality option)

Examples:

Following command creates jpeg files in a destination directory and makes them have their width 640 pixels wide, from source files from a given directory.

 

Following command creates jpeg files in the current directory, using the original jpeg files in the same directory and have all the new files resized to 20% of their original size.

Disk space saved by conversions to 20% of original size:


 

Deleting Original Files but Keeping Original Names

JpegSize.eze appends �_s.jpg� to the original name and uses this name to save the modified file. Original files remain untouched. However, some people may wish to have the modified files replace their originals.

This can be achieved by using a bat file to delete the original files but rename the new ones to indicate original names. This can be achieved by writing a Windows bat file. In this file, we can loop through files in a directory and for each file name that ends with �_s.jpg� we can strip that portion and reach the original name. Then we delete the original file, and rename the new _s.jpg file to the original name. This way we can rename filenames in bulk with one command.

Following batch file would do it: deleteold.bat :

@echo off

for /f "tokens=1" %%i in ('dir /b *_s.jpg') do (SET filename=%%i) & (call :process)
GOTO:EOF

:process
ECHo %filename%
SET _fname=%filename:~0,-6%
ECHO Renaming %filename% to %_fname%
DEl /Q /F %_fname%
RENAME %filename% %_fname%
:EOF
 

You can download deleteold.bat here.

Recursive Processing of Sub Directories

JpegSize.exe processes images in the current directory only. However, it is possible to write a batch file to execute JpegSize.exe for each of the sub directories as well.

An example of recursive processing of this command in a bat file is as follows:

@echo off

for /R %%i in (.) do (SET temp=%%i) & (call :process)
GOTO:EOF

:process
ECHO %temp%
SET dirname=%temp:~0,-1%
jpegsize.exe -srcdir %dirname% -destdir %dirname%
:EOF
 

You can download recursivesize.bat file here. Please edit this file to add necessary JpegSize command options that you need.

webmaster@gobestcode.com