|
17 | 17 |
|
18 | 18 | mkdir -p "$ICONSET_DIR" |
19 | 19 |
|
20 | | -# Scale factor for macOS icon guidelines: 832/1024 = 13/16 = 0.8125 |
21 | | -# This gives proper padding matching native macOS icons |
22 | | -SCALE=0.8125 |
23 | | - |
24 | | -# Generate all required icon sizes with padding |
25 | | -# Check if sips exists (macOS only) |
26 | 20 | if ! command -v sips &> /dev/null; then |
27 | 21 | echo "Warning: sips not found. Skipping ICNS generation (only supported on macOS)." |
28 | 22 | exit 0 |
29 | 23 | fi |
30 | 24 |
|
31 | 25 | sips -z 16 16 "$SOURCE_PNG" --out "$ICONSET_DIR/icon_16x16.png" > /dev/null |
32 | | -sips -Z $(echo "16 * $SCALE" | bc | cut -d. -f1) "$ICONSET_DIR/icon_16x16.png" --padToHeightWidth 16 16 > /dev/null |
33 | | - |
34 | 26 | sips -z 32 32 "$SOURCE_PNG" --out "$ICONSET_DIR/icon_16x16@2x.png" > /dev/null |
35 | | -sips -Z $(echo "32 * $SCALE" | bc | cut -d. -f1) "$ICONSET_DIR/icon_16x16@2x.png" --padToHeightWidth 32 32 > /dev/null |
36 | | - |
37 | 27 | sips -z 32 32 "$SOURCE_PNG" --out "$ICONSET_DIR/icon_32x32.png" > /dev/null |
38 | | -sips -Z $(echo "32 * $SCALE" | bc | cut -d. -f1) "$ICONSET_DIR/icon_32x32.png" --padToHeightWidth 32 32 > /dev/null |
39 | | - |
40 | 28 | sips -z 64 64 "$SOURCE_PNG" --out "$ICONSET_DIR/icon_32x32@2x.png" > /dev/null |
41 | | -sips -Z $(echo "64 * $SCALE" | bc | cut -d. -f1) "$ICONSET_DIR/icon_32x32@2x.png" --padToHeightWidth 64 64 > /dev/null |
42 | | - |
43 | 29 | sips -z 128 128 "$SOURCE_PNG" --out "$ICONSET_DIR/icon_128x128.png" > /dev/null |
44 | | -sips -Z $(echo "128 * $SCALE" | bc | cut -d. -f1) "$ICONSET_DIR/icon_128x128.png" --padToHeightWidth 128 128 > /dev/null |
45 | | - |
46 | 30 | sips -z 256 256 "$SOURCE_PNG" --out "$ICONSET_DIR/icon_128x128@2x.png" > /dev/null |
47 | | -sips -Z $(echo "256 * $SCALE" | bc | cut -d. -f1) "$ICONSET_DIR/icon_128x128@2x.png" --padToHeightWidth 256 256 > /dev/null |
48 | | - |
49 | 31 | sips -z 256 256 "$SOURCE_PNG" --out "$ICONSET_DIR/icon_256x256.png" > /dev/null |
50 | | -sips -Z $(echo "256 * $SCALE" | bc | cut -d. -f1) "$ICONSET_DIR/icon_256x256.png" --padToHeightWidth 256 256 > /dev/null |
51 | | - |
52 | 32 | sips -z 512 512 "$SOURCE_PNG" --out "$ICONSET_DIR/icon_256x256@2x.png" > /dev/null |
53 | | -sips -Z $(echo "512 * $SCALE" | bc | cut -d. -f1) "$ICONSET_DIR/icon_256x256@2x.png" --padToHeightWidth 512 512 > /dev/null |
54 | | - |
55 | 33 | sips -z 512 512 "$SOURCE_PNG" --out "$ICONSET_DIR/icon_512x512.png" > /dev/null |
56 | | -sips -Z $(echo "512 * $SCALE" | bc | cut -d. -f1) "$ICONSET_DIR/icon_512x512.png" --padToHeightWidth 512 512 > /dev/null |
57 | | - |
58 | 34 | sips -z 1024 1024 "$SOURCE_PNG" --out "$ICONSET_DIR/icon_512x512@2x.png" > /dev/null |
59 | | -sips -Z $(echo "1024 * $SCALE" | bc | cut -d. -f1) "$ICONSET_DIR/icon_512x512@2x.png" --padToHeightWidth 1024 1024 > /dev/null |
60 | 35 |
|
61 | 36 | echo "Converting iconset to ICNS..." |
62 | 37 |
|
|
0 commit comments