How to manually create icns files using iconutil?
Here's a script to convert a 1024x1024 png (named "Icon1024.png") to the required icns file. Save it to a filed called "CreateICNS.src" in the folder where your png file is then in terminal "cd" to the same folder and type "source CreateICNS.src" to call it:
mkdir MyIcon.iconset
sips -z 16 16 Icon1024.png --out MyIcon.iconset/icon_16x16.png
sips -z 32 32 Icon1024.png --out MyIcon.iconset/[email protected]
sips -z 32 32 Icon1024.png --out MyIcon.iconset/icon_32x32.png
sips -z 64 64 Icon1024.png --out MyIcon.iconset/[email protected]
sips -z 128 128 Icon1024.png --out MyIcon.iconset/icon_128x128.png
sips -z 256 256 Icon1024.png --out MyIcon.iconset/[email protected]
sips -z 256 256 Icon1024.png --out MyIcon.iconset/icon_256x256.png
sips -z 512 512 Icon1024.png --out MyIcon.iconset/[email protected]
sips -z 512 512 Icon1024.png --out MyIcon.iconset/icon_512x512.png
cp Icon1024.png MyIcon.iconset/[email protected]
iconutil -c icns MyIcon.iconset
rm -R MyIcon.iconset
Checkout the following instructions (link):
Use iconutil to Create an icns File Manually
The
iconutil
command-line tool convertsiconset
folders to deployment-ready, high-resolution icns files. (You can find complete documentation for this tool by enteringman iconutil
in Terminal.) Using this tool also compresses the resultingicns
file, so there is no need for you to perform additional compression.To convert a set of icons to an icns file
Enter this command into the Terminal window:
iconutil -c icns <iconset filename>
where
<iconset filename>
is the path to the folder containing the set of icons you want to convert toicns
. The output is written to the same location as theiconset file
, unless you specify an output file as shown:
iconutil -c icns -o <icon filename> <iconset filename>
In other words, you need to replace <iconset filename>
by the path:
/Users/myname/SDK Mac Apps/MyApp/grafica/icon.iconset
Since the path contains spaces, you need to use double quotes, for example:
iconutil -c icns "/Users/myname/SDK Mac Apps/MyApp/grafica/icon.iconset"
This command should work properly.