| Line | |
|---|
| 1 | #! /bin/bash |
|---|
| 2 | # Based on <http://stackoverflow.com/a/23688878/393146> |
|---|
| 3 | # converts the passed-in svgs to ico format |
|---|
| 4 | |
|---|
| 5 | if [[ "$#" -eq 0 ]]; then |
|---|
| 6 | echo "Usage: $0 svg1 [svg2 [...]]" |
|---|
| 7 | exit 0 |
|---|
| 8 | fi |
|---|
| 9 | |
|---|
| 10 | temp="$(mktemp -d)" |
|---|
| 11 | declare -a res=(16 24 32 48 64 256) |
|---|
| 12 | for f in "$*"; do |
|---|
| 13 | name="`basename -s .svg "$f"`" |
|---|
| 14 | iconset="$temp/${name}.iconset" |
|---|
| 15 | mkdir -p "$iconset" |
|---|
| 16 | for r in "${res[@]}"; do |
|---|
| 17 | inkscape -z -e "$iconset/${name}${r}.png" -w "$r" -h "$r" "$f" |
|---|
| 18 | done |
|---|
| 19 | resm=( "${res[@]/#/$iconset/${name}}" ) |
|---|
| 20 | resm=( "${resm[@]/%/.png}" ) |
|---|
| 21 | convert "${resm[@]}" "${f%%.*}.ico" |
|---|
| 22 | done |
|---|
| 23 | rm -rf "$temp" |
|---|
Note: See
TracBrowser
for help on using the repository browser.