imageprep is an image preparation utility for macOS. It is essentially a wrapper for sips. It has been tested with sips 316 as used in macOS 15.6.1.
imageprep no longer deletes source files by default as they are processed. For this reason, the -k and --keep switches have been removed and their use will throw an error.
To enforce source-file deletion, please use the new -x switch.
imageprep [--source path] [--destination path] \
[--action s scale_height scale_width] \
[--action p pad_height pad_width] \
[--action c crop_height crop_width] \
[--cropfrom anchor_point] [--offset y-coord x-coord] \
[--colour pad_colour] [--resolution dpi_value] \
[--format format_type] [--keep] [--overwrite] \
[--info] [--createdirs] \
[--help] [--version] \
{/path/to/file} ... {path/to/file}
For more detailed guidance on using imageprep, please see this page.
| Switch | Alternative Switch | Argument(s) | Description |
|---|---|---|---|
-s |
--source |
{path} |
The path to an image or a directory of images. Default: current working directory |
-d |
--destination |
{path} |
The path to the images. Default: source directory |
-a |
--action |
{type} {width} {height} |
The crop/pad dimensions. Type is s (scale), c (crop) or p (pad), eg. -a s 200 200 |
-c |
--colour |
{colour} |
The padding colour in Hex, eg. A1B2C3. Numbers may be prefixed #, $ or 0x, or habve no prefix. Default: FFFFFF |
--cropfrom |
{anchor point} |
Set an anchor point for crop actions. See Anchor Points below | |
--offset |
{x} {y} |
Set an anchor point for crop actions. See Anchor Points below | |
-r |
--resolution |
{dpi} |
Set the image dpi, eg. 300 |
-f |
--format |
{format} |
Set the image format: JPG/JPEG, PNG, GIF, BMP or TIF/TIFF |
-j |
{level} |
Specify a compression level (percentage) for JPEG images. Default: 80 | |
--createdirs |
Create intermediate directories to the destination, if needed. Default: do not create | ||
-o |
--overwrite |
Overwrite an existing file. Without this, existing files will be kept | |
--info |
Output image information in machine-readable form: path, width, height, resolution and alpha state | ||
-x |
Delete the source file. Without this, the source will be retained | ||
-q |
--quiet |
Silence output messages (errors excepted) | |
-h |
--help |
Show help information | |
--version |
Show version information |
You can add any number of actions: they will be applied in the order they appear at the command line.
You can specify an anchor point for crop operations. Use the --cropfrom switch and a value to indicate the anchor point: text markers, eg. tr for top-right, bl for bottom-left or cr for centre-right, etc., or a numerical value:
| Left | Centre | Right | |
|---|---|---|---|
| Top | TL |
TC |
TR |
| Centre | CL |
N/A | CR |
| Bottom | BL |
BC |
BR |
| Left | Centre | Right | |
|---|---|---|---|
| Top | 0 |
1 |
2 |
| Centre | 3 |
N/A | 5 |
| Bottom | 6 |
7 |
8 |
You can specify crop anchors as x and y co-ordinates: this is the co-ordinate of the top left point of the retained area. For example, with a 1920 x 1080 image, to crop out all but a 500 by 400 area in the top left of the image, you would specify 500 and 400 as your width and height values, and 10 and 20 as your offset co-ordinates. Offset values cannot be negative, and values beyond the dimensions of the source image will be ignored.
Please note that if you specify a crop anchor point using --cropfrom, it will override any offset value you specify.
Any output JPEG images are compressed. The default quality setting is 80%. From version 7.0.0, you can specify an alternative value using the -j switch followed by a percentage value, eg, -j 55. The request for this feature centred solely on JPEG images, but I hope to support other formats’ compression schemes in future releases.
Contributions are welcome, but pull requests can only be accepted when they target the develop branch. PRs targetting main will be rejected.
See CHANGELOG.md.
Note imageprep was initially released as version 6.0.0 for historical reasons: previous versions were released in the form of shell scripts.
imageprep is copyright © 2025, Tony Smith.
imageprep’s source code is issued under the MIT Licence.