处理图片的利器 sips

1
2
3
4
5
6
7
8
## 常用命令
sips --out output.png --resampleWidth ${width} input.png

## 批量处理(会覆盖源图片)
#### 指定宽度、保持比例
sips --resampleWidth ${width} *.jpg
#### 指定宽高
sips -z ${height} ${width} *.jpg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
MacBook-Pro:ICON fang$ 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