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.
All these options are optional.
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.
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:
filename.png[?size,x,y[?opacity]]
If you want to use spaces, set the parameter in quotes. Defaults are size=20%, x=98%, y=98%, opacity=50%
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.
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.
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.
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%"