SVG to ICNS script for Mac OS X

terminalLo script della shell Bash converte una icona in format SVG (vettoriale) in tante icone PNG a differenti risoluzioni e poi le impacchetta in un file icona format .ICNS nativo della piattaforma Mac OS X.

echo "*** SVG 2 ICNS ***"
if [ $# -ne 1 ]; then
	echo "Usage:   svg2icns filename.svg"
	exit 100
echo "processing: $name"
mkdir "$dest"
	# first create a full size PNG
qlmanage -t -s 1024 -o "$dest" "$1"
	# now create thumbs
sips -z 16 16 "$image" --out "$dest/icon_16x16.png"
sips -z 32 32 "$image" --out "$dest/icon_16x16@2x.png"
cp "$dest/icon_16x16@2x.png" "$dest/icon_32x32.png"
sips -z 64 64 "$image" --out "$dest/icon_32x32@2x.png"
sips -z 128 128 "$image" --out "$dest/icon_128x128.png"
sips -z 256 256 "$image" --out "$dest/icon_128x128@2x.png"
cp "$dest/icon_128x128@2x.png" "$dest/icon_256x256.png"
sips -z 512 512 "$image" --out "$dest/icon_256x256@2x.png"
cp "$dest/icon_256x256@2x.png" "$dest/icon_512x512.png"
sips -z 1024 1024 "$image" --out "$dest/icon_512x512@2x.png"
iconutil -c icns "$dest"
rm -R "$dest"

You may also like...

1 Response

  1. Grigory Entin says:

    Thanks, it’s quite handy!

Leave a Reply

Your email address will not be published. Required fields are marked *