Why setting image as its own icon with sips result a blurred icon? Are there any alternatives?

Solution 1:

I think I've found a workaround!

First off, install osxutils bundle which is a bit dated (2005) but nevertheless it works. (see the osxutils contents and man pages)

Prepare the PNG to ICNS—ironically you can use sips. Then use seticon from the osxutils bundle to change the icon:

$ sips -s format icns FIN.png --out FIN.icns
$ seticon -d FIN.icns FIN.png

The seticon also changes the file's attributes, ie. using SetFile -a C isn't necessary.


†: Using a PNG as a source file for seticon changes the icon to a generic PNG icon, even with -d option. Furthermore, using seticon FIN.icns FIN.png changes the icon to a generic ICNS icon. (Consult the seticon's man pages)

‡: NB: the source file must be a square and possible side-lengths are: 16, 32, 48, 128, 256 and 512.