imgres is a command line interface (CLI) for the bulk resizing and watermarking tool TImageResize. It converts (resamples) JPEG and PNG images.
imgres filename folder size
[-j jpgquality]
[-p pngcompression]
[-w watermark]
[-t threadcount]
[-r rename]
[-x]
[-h] [-q]
filename |
|
folder |
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. |
size |
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. |
-h -help |
Shows a help text. |
-q -quiet |
Quiet mode, supresses any console output. |
-j value -jpgquality value |
A value between 1 and 100, where 1 is the lowest and 100 is the highest quality. This partameter refers only to jpg files. |
-p value -pngcompression value |
One of the strings 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 value -watermark value |
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 value format is:
If you want to use spaces, set the parameter in quotes. Defaults are size=20%, x=98%, y=98%, opacity=50% |
-t value -threadcount value |
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. If you have 4 source files and 2 destination sizes, you will get 8 tasks. |
-x -stoponerror |
If an error occures, this flag lets the program stop as soon as possible. Note: some tasks may run intoo the same error and report it. |
-r template -rename template |
Enables destination file renaming. Enter a filename template as
parameter. The template can contain up to 4 placeholders: |
The tool needs a source file, a destination folder and a destination size. It loads the image (jpg or png), resamples it to the desired size and saves the result to the destination folder, always using the original name.
To resample 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.
imgres @imglist.txt .\img%SIZE% 240,640,1280
Note: the placeholder %SIZE% in the destination path is required.
imgres image.jpg img640 640 -w "watermark.png?60,2,98?20"
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 MyImages\*.jpg;*.png .\images 200,1920 -r "img%INDEX:1,3%_%SIZE%.%FILEEXT%"
This example demontrates how to create all resized image files to a single folder. The trick is to build in the destination size into the filename that all filenames become unique.