sips (scriptable image processing system) is a prebundled command tool which can used to manipulate images. There are two advantages:
- it is prebundled, you don't need to download and install it.
- it uses CoreImage so it is very fast.
Here are some examples:
1. Get Image size
$sips --getProperty pixelWidth xxx.jpg
pixelWidth: 3264
$sips --getProperty pixelHeight xxx.jpg
pixelHeight: 2448
2. Resize an image
$sips -z 100 100 xxx.jpg
resize xxx.jpg to 100x100
$sips --resampleWidth 100 xxx.jpg
resize xxx.jpg 's width to 100, and resize the height to keep its ratio.
$sips --resampleHeight 100 xxx.jpg
resize xxx.jpg's height to 100, and resize its width to keep the original ratio.
You can check its man page here: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/sips.1.html
src
No comments:
Post a Comment