#!/bin/bash

ICONSET="icon.iconset"
PNG="$1"

if [ -z "$PNG" ]; then
  echo "Usage: $0 icon.png"
  exit 1
fi

mkdir -p $ICONSET

# Erzeuge alle Größen
sips -z 16 16     "$PNG" --out $ICONSET/icon_16x16.png
sips -z 32 32     "$PNG" --out $ICONSET/icon_16x16@2x.png
sips -z 32 32     "$PNG" --out $ICONSET/icon_32x32.png
sips -z 64 64     "$PNG" --out $ICONSET/icon_32x32@2x.png
sips -z 128 128   "$PNG" --out $ICONSET/icon_128x128.png
sips -z 256 256   "$PNG" --out $ICONSET/icon_128x128@2x.png
sips -z 256 256   "$PNG" --out $ICONSET/icon_256x256.png
sips -z 512 512   "$PNG" --out $ICONSET/icon_256x256@2x.png
sips -z 512 512   "$PNG" --out $ICONSET/icon_512x512.png
sips -z 1024 1024 "$PNG" --out $ICONSET/icon_512x512@2x.png

iconutil -c icns icon.iconset
