initial
This commit is contained in:
commit
e71ddecd35
16
README
Normal file
16
README
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
mkicns.sh is script that automates creating icns bundle from single PNG image.
|
||||||
|
|
||||||
|
REQUIREMENTS
|
||||||
|
|
||||||
|
- macOS
|
||||||
|
- convert utility from imagemagick
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
|
||||||
|
mkicns.sh --source icon.png --output icon
|
||||||
|
|
||||||
|
As a result of above command, icon.icns will be created.
|
||||||
|
|
||||||
|
LICENSE
|
||||||
|
|
||||||
|
BSD-2c
|
82
mkicns.sh
Executable file
82
mkicns.sh
Executable file
@ -0,0 +1,82 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
PROGPATH="$0"
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<-_EOT
|
||||||
|
Usage: $PROGPATH <OPTIONS>
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--source PNG source (should be 1024x1024)
|
||||||
|
--output iconset name, will be created in current directory
|
||||||
|
_EOT
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
error() {
|
||||||
|
echo "error: $@" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
SOURCE=
|
||||||
|
OUTPUT=
|
||||||
|
|
||||||
|
while :; do
|
||||||
|
case $1 in
|
||||||
|
--source)
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
SOURCE="$2"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
error "$q requires an argument"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
--output)
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
OUTPUT="$2"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
error "$q requires an argument"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
|
||||||
|
-?*)
|
||||||
|
error "unknown option: %s" "$1"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
[ -z "$SOURCE" ] && usage
|
||||||
|
[ -z "$OUTPUT" ] && usage
|
||||||
|
[ ! -f "$SOURCE" ] && error "source file '$SOURCE' does not exists"
|
||||||
|
|
||||||
|
mkdir $OUTPUT.iconset || error "failed to create temporary iconset directory"
|
||||||
|
|
||||||
|
convert -background none -resize 16x16 -gravity center -extent 16x16 $SOURCE $OUTPUT.iconset/icon_16x16.png
|
||||||
|
convert -background none -resize 32x32 -gravity center -extent 32x32 $SOURCE $OUTPUT.iconset/icon_16x16@2x.png
|
||||||
|
convert -background none -resize 32x32 -gravity center -extent 32x32 $SOURCE $OUTPUT.iconset/icon_32x32.png
|
||||||
|
convert -background none -resize 64x64 -gravity center -extent 64x64 $SOURCE $OUTPUT.iconset/icon_32x32@2x.png
|
||||||
|
convert -background none -resize 64x64 -gravity center -extent 64x64 $SOURCE $OUTPUT.iconset/icon_64x64.png
|
||||||
|
convert -background none -resize 128x128 -gravity center -extent 128x128 $SOURCE $OUTPUT.iconset/icon_64x64@2x.png
|
||||||
|
convert -background none -resize 128x128 -gravity center -extent 128x128 $SOURCE $OUTPUT.iconset/icon_128x128.png
|
||||||
|
convert -background none -resize 256x256 -gravity center -extent 256x256 $SOURCE $OUTPUT.iconset/icon_128x128@2x.png
|
||||||
|
convert -background none -resize 256x256 -gravity center -extent 256x256 $SOURCE $OUTPUT.iconset/icon_256x256.png
|
||||||
|
convert -background none -resize 512x512 -gravity center -extent 512x512 $SOURCE $OUTPUT.iconset/icon_256x256@2x.png
|
||||||
|
convert -background none -resize 512x512 -gravity center -extent 512x512 $SOURCE $OUTPUT.iconset/icon_512x512.png
|
||||||
|
convert -background none -resize 1024x1024 -gravity center -extent 1024x1024 $SOURCE $OUTPUT.iconset/icon_512x512@2x.png
|
||||||
|
|
||||||
|
iconutil --convert icns $OUTPUT.iconset
|
||||||
|
|
||||||
|
rm -R $OUTPUT.iconset
|
Loading…
x
Reference in New Issue
Block a user