-
Notifications
You must be signed in to change notification settings - Fork 0
/
watchos-application-icon
executable file
·59 lines (46 loc) · 1.5 KB
/
watchos-application-icon
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
56
57
58
59
#!/bin/sh
# https://github.com/davidfmiller/bin/
if [[ "`which sips`" = "" ]]
then
>&2 echo "🚫 OS X only"
exit 1
fi
if [[ "$1" = "" ]]
then
>&2 echo "🚫 No icon file provided"
exit 1
fi
if [ ! -e "$1" ]
then
>&2 echo "🚫 Invalid icon provided"
exit 1
fi
filename=$(basename "$1")
extension="${filename##*.}"
target="$HOME/Desktop/${filename%.*}"
if [ -d "$target" ]
then
echo "🚫 Destination folder '$target' already exists"
exit 1
fi
mkdir "$target"
# notification center
sips -Z 32 "$1" --out "$target/16@2x.${extension}"
sips -Z 40 "$1" --out "$target/20@2x.${extension}"
sips -Z 48 "$1" --out "$target/24@2x.${extension}"
sips -Z 55 "$1" --out "$target/27.5@2x.${extension}"
sips -Z 58 "$1" --out "$target/29@2x.${extension}"
sips -Z 66 "$1" --out "$target/33@2x.${extension}"
sips -Z 80 "$1" --out "$target/40@2x.${extension}"
sips -Z 87 "$1" --out "$target/29@3x.${extension}"
sips -Z 88 "$1" --out "$target/44@2x.${extension}"
sips -Z 92 "$1" --out "$target/46@2x.${extension}"
sips -Z 100 "$1" --out "$target/50@2x.${extension}"
sips -Z 102 "$1" --out "$target/51@2x.${extension}"
sips -Z 172 "$1" --out "$target/86@2x.${extension}"
sips -Z 196 "$1" --out "$target/98@2x.${extension}"
sips -Z 216 "$1" --out "$target/108@2x.${extension}"
sips -Z 234 "$1" --out "$target/117@2x.${extension}"
sips -Z 1024 "$1" --out "$target/1024.${extension}"
echo "# watchos-icon\n\nGenerated by [watchos-application-icon](https://github.com/davidfmiller/bin/)" > "$target/readme.md"
open "$target"