File: make_icns.sh

package info (click to toggle)
copyq 3.7.3-1~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 10,480 kB
  • sloc: cpp: 51,894; sh: 734; python: 211; xml: 57; makefile: 34
file content (40 lines) | stat: -rwxr-xr-x 719 bytes parent folder | download | duplicates (2)
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
#!/bin/bash
set -ex

image_dir=src/images
tmp_dir=icon.iconset

out=${image_dir}/icon.icns

rm -rf "${tmp_dir}"
mkdir -p "${tmp_dir}"

convert_img () {
    size=$1
    highdpi=$2

    target_img=${tmp_dir}/icon_${size}x${size}
    if [[ -n "$highdpi" ]]; then
        target_img="${target_img}@${highdpi}x"
        size=$(expr $size \* $highdpi)
    fi
    target_img="${target_img}.png"

    source_img=${image_dir}/icon_${size}x${size}.png

    cp "$source_img" "$target_img"
}

convert_img 16
convert_img 16 2
convert_img 32
convert_img 32 2
convert_img 128
convert_img 128 2
convert_img 256
convert_img 256 2
convert_img 512
convert_img 512 2

iconutil --convert icns --output $out "${tmp_dir}"
rm -rf "${tmp_dir}"