fjh-mac-pro:2013_04_27 fengjianhua$ sips --help
sips 10.4.4 - scriptable image processing system.
This tool is used to query or modify raster image files and ColorSync ICC profiles.
Its functionality can also be used through the "Image Events" AppleScript suite.
Usages:
sips [-h, --help]
sips [-H, --helpProperties]
sips [image-query-functions] imagefile ...
sips [profile-query-functions] profile ...
sips [image modification functions] imagefile ...
[--out result-file-or-dir]
sips [profile modification functions] profile ...
[--out result-file-or-dir]
Profile query functions:
-g, --getProperty key
-X, --extractTag tag tagFile
-v, --verify
Image query functions:
-g, --getProperty key
-x, --extractProfile profile
Profile modification functions:
-s, --setProperty key value
-d, --deleteProperty key
--deleteTag tag
--copyTag srcTag dstTag
--loadTag tag tagFile
--repair
Image modification functions:
-s, --setProperty key value
-d, --deleteProperty key
-e, --embedProfile profile
-E, --embedProfileIfNone profile
-m, --matchTo profile
-M, --matchToWithIntent profile intent
--deleteColorManagementProperties
-r, --rotate degreesCW
-f, --flip horizontal|vertical
-c, --cropToHeightWidth pixelsH pixelsW
-p, --padToHeightWidth pixelsH pixelsW
--padColor hexcolor
-z, --resampleHeightWidth pixelsH pixelsW
--resampleWidth pixelsW
--resampleHeight pixelsH
-Z, --resampleHeightWidthMax pixelsWH
-i, --addIcon
在 Mac 中有沒有快速縮小圖片尺寸的方法
比如,你想要將某檔案夾的 n 張大尺寸JPG圖片都縮小成寬度為600px的圖片,高度自動按比例縮放。那麼命令則為(假設檔案夾的路徑為 ~/Desktop/fengjianhua):
sips -Z 600 ~/Desktop/fengjianhua/*.JPG
執行完成之後,你案頭上fengjianhua檔案夾中的所有JPG圖片都縮小成寬度為600px的小尺寸版本了。另外,sips 還有很多功能有待你挖掘,比如你還可以指定高度和寬度(注意z需要小寫):
sips -z 300 600 ~/Desktop/fengjianhua/*.JPG
你還可以用 sips 命令批量旋轉圖片,預設旋轉方式為順時針,下面是將圖片順時針旋轉90度的方法:
sips -r 90 ~/Desktop/fengjianhua/*.JPG
其實,你甚至可以以不規則的角度旋轉,比如旋轉120度,大家自己試試是什麼效果吧。
還可以用來翻轉圖片,不管是水平翻轉還是垂直翻轉都可以。水平翻轉命令為:
sips -f horizontal ~/Desktop/fengjianhua/*.JPG
垂直翻轉命令為:
sips -f vertical ~/Desktop/fengjianhua/*.JPG