[These pages contain ready scripts. You can use them in your own applications]
Auto resize digicam images in the directory
Note: all scripts examples included in these Web pages are
absolutely free. You can copy, use, and modify these scripts anyway
you want. The scripts are published without warranty of any kind.
As a rule, all modern digital photo cameras make images having big size.
For example, 5 mega-pixels digital camera makes 2608x1952 images. This resolution is good
for printing images to standard or even A4 sheets of photo paper. However, what's about
simple showing images on the screen with any viewer?
Such big images
are hardly visible on the screen with usual resolution, for example 1024x768, 1600x1200 etc.
The image doesn't go in screen size and you see only part of image. You have to either scroll
your big image on the screen or resize image to screen size using your image viewer capabilities.
However, there is always a contradiction between resize speed and resize quality.
If application will use a fast simple method then resized image can have low quality, but
good quality method can spend some time, and this is important for such things as slideshow,
when you view images one by one.
Also you may need to resize images to specified size if you want to prepare
images for web publication as a photo gallery: image thumbnails should be small and, therefore,
fast downloadable.
Here is the one of possible solutions: you can prepare all images of necessary size
from original ones in advance, before viewing them and, after completion, show new optimally
resized good quality images.
The script can help you
to auto-resize all images in specified directory to desired size.
Source images are not overwritten: script writes files with new names.
Description
This .vbs script implements such solution. It can get your images in the
directory and prepare resized images with new file names. Aspect ratio is kept: every image
is resized so that image fits the specified size.
For example, you need to resize three images having sizes 1600x1200, 2608x1952 and 1200x1600.
The images will be resized to 1024x768, 1024x766, 576x768.
The script has the following advantages:
Script can be run both by double clicking (using wscript.exe processor) and from command line
(using cscript processor). From command line you can pass additional parameters
and alter script behaviour (image size, source and target directories etc.)
(Optional). Script can use Exif data and auto-rotate image, if photo camera had
a orientation sensor.
(Optional). Script can print Exif data (date and time when image was taken) over image,
if image contains Exif data.
(Optional). The script can generate HTML page skeleton for your photo gallery.
Script can be run either by double-clicking its icon (using the default wscript.exe Windows
Scripting Host processor) or from command line (using the cscript.exe WSH processor).
In the first case the script will handle all images in the current directory.
Being run from command line, the script is more configurable: you can pass additional parameters and
specify:
1) directory, where source images are located
2) directory, where newly created images will be placed to
3) maximal dimensions for newly created images
4) grid size for HTML gallery, if this parameter is present then HTML skeleton files
containing thumbnails of specified size will be created
Examples with command line parameters
c:\>cscript resize2screen.vbs d:\photos\birthday d:\web\thumbs 100x100 6x5
This command gets all jpeg images from "d:\photos\birthday" directory, writes
thumbnails to "d:\web\thumbs" directory and creates the HTML skeleton files
gallery1.htm, gallery2.htm etc. having thumbnails ordered in a grid with
6 thumbnails in a row and 5 thumbnails in a column.
c:\>cscript resize2screen.vbs d:\photos\birthday d:\screensize 1024x768
This command gets all jpeg images from "d:\photos\birthday" and writes resized to
1024x768 images to "d:\screensize" directory.
Photo examples
These files were made by this script and had 2608x1952 size before processing.
Printing Exif date/time of photo creation was switched on.
[photo 1][photo 2]Back to examples