[Mac] 使用 sips 快速批次調整圖片大小

[Mac] 使用 sips 快速批次調整圖片大小

最近不知道在哪裡看到,原來 Mac 上有內建 sips 圖片處理工具~

sips 代表的是 scriptable image processing system,

因為是命列列 command line 模式的程式,

因此可以很方便的整合在 script 裡呼叫~

 

執行 sips –help 可以看到說明:

testuser@localhost ~ $ 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

 

舉例來說,我有一些 PNG 圖片是 1024×768 的大小,

想要把它們都設定成寬度為 600 的話,可以這麼用:

sips --resampleWidth 600 *.png

 

sips 處理的速度非常的快,十幾張圖幾乎可以說是 1 秒鐘就全部改好大小了,

是 Mac 上小巧有用的好工具喔~^^

 

(本頁面已被瀏覽過 154 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料