-
-
Save neoasis-werx/6933aa0d2665b6aafd7efb916879d1fb to your computer and use it in GitHub Desktop.
[BASH: Image Conversion: SVG to Mac ICNS] #convert #image #file_type #bash #script #icon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # iterate over the svg files fed into on the command line | |
| for svgfile in "$@" | |
| do | |
| name=${f%.*} | |
| ext=${f##*.} | |
| echo "Processing $name ..." | |
| set -e | |
| mkdir $name.iconset | |
| # run inkscape from the command line to generate the iconset formatted for icns | |
| inkscape -z -e "$PWD/$name.iconset/icon_16x16.png" -w 16 -h 16 "$PWD/$svgfile" | |
| inkscape -z -e "$PWD/$name.iconset/[email protected]" -w 32 -h 32 "$PWD/$svgfile" | |
| inkscape -z -e "$PWD/$name.iconset/icon_32x32.png" -w 32 -h 32 "$PWD/$svgfile" | |
| inkscape -z -e "$PWD/$name.iconset/[email protected]" -w 64 -h 64 "$PWD/$svgfile" | |
| inkscape -z -e "$PWD/$name.iconset/icon_128x128.png" -w 128 -h 128 "$PWD/$svgfile" | |
| inkscape -z -e "$PWD/$name.iconset/[email protected]" -w 256 -h 256 "$PWD/$svgfile" | |
| inkscape -z -e "$PWD/$name.iconset/icon_256x256.png" -w 256 -h 256 "$PWD/$svgfile" | |
| inkscape -z -e "$PWD/$name.iconset/[email protected]" -w 512 -h 512 "$PWD/$svgfile" | |
| inkscape -z -e "$PWD/$name.iconset/icon_512x512.png" -w 512 -h 512 "$PWD/$svgfile" | |
| inkscape -z -e "$PWD/$name.iconset/[email protected]" -w 1024 -h 1024 "$PWD/$svgfile" | |
| # run osx iconutil app to convert the iconset to icns format | |
| iconutil -c icns "$name.iconset" | |
| #cleanup | |
| rm -R "$name.iconset" | |
| done | |
| echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment