imgres CLI


imgres 4.0 is a command line interface (CLI) for the bulk scaling tool ImageResize. It converts (resamples) JPEG and PNG images.



imgres source target size {option [value]}


All these parameters are required.

One of either
  • Path/filename of an image file to be scaled. This can be a JPEG file or a PNG file.
  • Text file with a filename list. The filename must be preceeded by @.
  • Path/wildcards - i.e. C:\MyImages\img???.jpg;*.png
The folder where to store the resulting file. This can be a relative path. If its the dot '.' the result will be saved "inplaced", replacing the source file.
If you create multiple files with different sizes, enter a placeholder %SIZE% where the program will insert the size or enter a renaming parameter.
Size in pixels of the resampled image. The size refers to the longer side of the image. This means, imgres always bewares the width/heigth ratio.
You can specify multiple sizes, separated by a comma to let the process create multiple resampled files. Because the files will have the same names, it is required to enter a placeholder %SIZE% in the dstfolder.


All these options are optional.

Shows the CLI help.
Quiet mode, supresses any console output.
-i name
-interpolation name

One of: Stretch, Box, Linear, HalfCosine, Cosine, Bicubic, Mitchell, Spline, Lanczos2, Lanczos3, Lanczos4, BestQuality

The interpolation algorithm wich is applied while resampling. Default is Lanczos2. Best Quality means, that depending on upsampling or downsampling either Spline or Mitchell is selected automatically.

JPEG Quality
-j quality
-jpeg quality
A value between 1 and 100, where 1 is the lowest and 100 is the highest quality. This parameter refers only to JPEG files.
PNG Compression
-p compression
-png compression
One of: none, fastest, default and max. The PNG format has a loss-less compression, so this parameter has an impact to the compression/decompression effort, not to the image quality.
-w descriptor
-watermark descriptor

A watermark is a PNG image containing a copyright or what ever. The watermark can be printed an any position. The position is in percent and refers to the images width resp. height. The Size is in percent of the images width.

The positions in percent refers to the difference of the images size and the watermarks size. Thus, 50%/50% centeres the image. 0% is left/upper alignment, 100% results in a right/bottom aligment.

The descriptor format is:


If you want to use spaces, set the parameter in quotes. Defaults are size=20%, x=98%, y=98%, opacity=50%

-e keywords
-exif keywords
Inserts EXIF tags listed in the taglist into the target files. The keywords are comma-separated Title, Timestamp and Copyright. Other tags are not supported. The source of tags are either existing EXIF tags or .tags files. More details here.
-c text
-copyright text
Inserts an EXIF Copyright tag with the given text. This overrides any existing Copyright tags in the original files. More details here.
Meta Information
-m keywords
-meta keywords
Controls the source of the EXIF tagging by the -e switch. keywords are EXIF and TAGS. EXIF means the internal tags dictionary is filled with EXIF tags from the original files. TAGS means, that files named .tags are interpreted, if they exist. If both keywords are selected, separate them with a comma. See more details here.
Tags Listings
-l keywords
-listings keywords
imgres maintains an internal dictionary with tags. It is filled either by EXIF tags or by additional .tags files in each source folder. The -l switch lets imgres dump its contents to a .csv formatted UTF-8 encoded file. keywords stands for a combination of TagsReport and Images. See more details here.
Threads Count
-t number
-threads number

0 - (default) uses as many threads as processors are availabe

1 - single thread, all resamplings are in sequential order

n - number of threads to use. n is automatically limited to either the number of available processors or the number of tasks.

A "task" is a resampling request. For each source file a task is launched.

Stop on Error
-s 0|1
-stoponerror 0|1
If an error occures, this flag lets the program stop as soon as possible. Note: some tasks may run into the same error and report it.
-r template
-r template

Enables target file renaming. Enter a filename template as parameter. The template can contain up to 4 placeholders:

%FILENAME% stands for the original file title. That is the filename without path and without extension.

%FILEEXT% is the file extension without the leading dot.

%INDEX[:n[,d]]% is the current number of the source image in the list of files. n is the start index, default is 1. d is the number of digits to print. The resulting number will be filled with leading zeroes. if d is auto, the program will calculate the number of digits automatically. This is the default. %INDEX% is equivalent to %INDEX:1,auto%.

Target file renaming with the %SIZE% -placeholder enables you to create all resized images into the same folder without any naming conflict.

See available placeholders.

-s seed
-shuffle seed

Mixes (shuffles) the renamed target files randomly. To get the same (random) sequence of files, enter a seed not equal to zero. Multiple executions of the resampling processor will then result in the same order, as long as the number of files does not change.

A seed of 0 results in another sequence of files you press Execute.

If you want to mix the target files, its recommended to insert the %INDEX% placeholder at a first placeholder in the filename template for renaming. The system uses a file attribute for sorting (usually the name of the the file), when listing them.

Dry Run
No images are beeing created but if required .imgtags files are beeing created.


For resampling multiple files you can create a list of files like this

dir /B *.jpg > imglist.txt

To use the filelist, put an @ in front of the lists path and name

imgres @imglist.txt .\img640 640

To resample multiple files in multiple resolutions, just enter multiple comma separated sizes without spaces.

Note: the placeholder %SIZE% in the target path is required.

imgres @imglist.txt .\img%SIZE% 240,640,1280

This creates a 640px jpg with a 640*60%=384px size watermark at the left bottom corner. 2% for the left margin, 98% percent means 2% from the bottom border.

imgres image.jpg img640 640 -w "watermark.png?60,2,98?20"

This example demonstrates how to create all resized image files to a single folder. The trick is to build in the target size into the filename that all filenames become unique.

imgres MyImages\*.jpg;*.png .\images 200,1920 -r "img%INDEX:1,3%_%SIZE%.%FILEEXT%"

This example mixes the files randomly with a random seed of 1000.

imgres MyImages\*.jpg .\images 1920 -s 1000 -r "img%INDEX:1,3%.%FILEEXT%"