To resize an image, use the predefined task resize.
By default, images are resized to 1280x768 (width x height).
anchor -t resize
We usually instead specify a different target size with the
-ps command-line option which offers multiple possibilities.
-icommand-line option (therefore reading images from the current directory) and the
-ocommand-line option (therefore outputting into a temporary directory).
Resizing with a scaling factor
To resize to half the existing width and height:
anchor -t resize -ps 0.5
To resize to double the existing width and height:
anchor -t resize -ps 2
Resizing to a specific width and height
To resize to specifically 1024x768 (width x height), breaking aspect ratio if necessary.
anchor -t resize -ps 1024x768
Resizing preserving aspect ratio
To resize to 800 pixels width, preserving existing aspect ratio.
anchor -t resize -ps 800x
To resize to 600 pixels height, preserving existing aspect ratio.
anchor -t resize -ps x600
To resize to the maximal-size possible, preserving existing aspect ratio, that fits inside 1000x900.
anchor -t resize -ps 1000x900+
Resizing to preserve file-names and any non-image files
The following command immutably resizes images from a source directory into a destination directory, preserving filenames, directory-structure and any adjacent non-image files.
anchor -i c:\foo\source\ -ip -ic -t resize -ps 250x350 -oo c:\bar\destination\
Resizing with a common-size across all outputted images
center task will resize, in a similar way to above accepting an identical
-ps argument, but ensure all outputted images have identical size.
It will add padding (with black color i.e. intensity value 0) around the resized image, centering it in the larger image, to achieve the consistent common size.
# Resizes every image to 400 pixels width, while preserving aspect ratio, and centering vertically. anchor -t center -ps 400x # Resizes every image to 300 pixels height, while preserving aspect ratio, and centering horizontally. anchor -t center -ps x300 # Preserves aspect ratio, and makes sure an image is never greater than 1000x900, centering horizontally # and vertically. anchor -t center -ps 1000x900+ # Resizes every image to half its existing size, taking the maximum size in each dimension as a common # size in which any smaller images are centered horizontally and vertically. anchor -t center -ps 0.5