Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Covert ICNS to image file formats using sips UNIX
I was recently involved in a thread on the Apple discussion forums that involved converting ICNS files to various image file formats. I had been using the unix sips command to accomplish this task for quite a while in my own scripts. I never thought to mention it as an undocumented feature, until the original poster of the thread mentioned it might be something others would find useful.

Use the following command to convert (as an example) an ICNS file to a png image file:
sips -s format png /Path/To/Icon.icns --out /Path/To/ConvertedImage.png
The command above would convert an ICNS file named Icon.icns to a png file named ConvertedImage.png. To convert to other image file formats, simply replace the portion of the command that reads png with the file format of your liking. You can choose from these possible formats: jpeg, tiff, png, gif, jp2, pict, bmp, qtif, psd, sgi, and tga.

As I mentioned in the thread at Apple's site, you can type man sips, sips -h or sips -H to access the sips manual and help pages, but there isn't any mention of its ability to work with the ICNS file format. The only formats listed are those shown above. Hope this helps someone else out as much as it has I and the poster of the original question at Apple's site...
  • Currently 3.38 / 5
  You rated: 4 / 5 (8 votes cast)

Covert ICNS to image file formats using sips | 7 comments | Create New Account
Click here to return to the 'Covert ICNS to image file formats using sips' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Covert ICNS to image file formats using sips
Authored by: gaoshan on Jan 03, '06 10:15:04AM

I was going to add this reply saying that you could also do this with Imagemagick (my favorite command line image manipulator) however, you can't!

So... you CAN'T use Imagemagick to do this. Good to know. I used to think of sips as a weak image manipulator that I had no use for. You've proven me wrong.


[ Reply to This | # ]
sips vs. imagemagick
Authored by: efc on Jan 03, '06 10:04:46PM
I've used both sips and imagemagick on a PowerMac G5. In addition to the undocumented feature mentioned in this hint, it is worth noting that in my work I've found sips to be at least 5 times faster than imagemagick. I don't know for sure, but my guess is that sips is using the Velocity engine in a way imagemagick (or at least the binary I had of it) does not.

True, imagemagick has more features than sips. But if sips can do the job and you have a lot of bulk work to get done, it can save a load of time.

[ Reply to This | # ]

Covert ICNS to image file formats using sips
Authored by: Pedro Estarque on Jan 04, '06 06:17:05AM

Way to go ChaChi !!!

And to gaoshan, yes I tried ImageMagick too, but it seems ICNS is a rather obscure format in the unix world.

efc - sips is highly optimized, it's a true hidden jewel in OS X. Not only is it much faster then IM, it's faster then anything I've ever seen. It does, however, lose for Adobe in terms of quality. If you want a true good looking JPEG, Adobe's algorithm will give you a better result albeit much slower.

[ Reply to This | # ]
Covert ICNS to image file formats using sips
Authored by: bailey_ca on Jan 15, '06 08:40:48PM

If you just want access to the icon(s) in the .icns file, try icns2icon. (See this hint.)

[ Reply to This | # ]
Covert ICNS to image file formats using sips
Authored by: ekologik on May 25, '08 07:04:59PM

for me it didn't work if i put /Path i had to just put Path, without the slash. i'm running leopard. dunno if that makes a difference of if you just made a typo. but thanks for the tip, it works now that i figured out that small thing.

[ Reply to This | # ]
Covert ICNS to image file formats using sips
Authored by: c0reysc0tt on Sep 14, '11 11:42:04AM
Cool! Just found this tip after realizing that ICNS to PNG had been using Rosetta and no longer works with Lion. I wasn't familiar with sips, so thanks for posting this tip 5 years ago! :-D Anyway, I turned it into a little AppleScript app if anyone is interested:

on run
	set originalFile to (quoted form of (POSIX path of (choose file with prompt "Choose a file to convert:" default location the path to home folder)))
	set newFile to (POSIX path of (choose file name with prompt "Save the new file as:" default name "Untitled" default location the path to desktop folder))
	set supportedTypes to {"jpeg", "tiff", "png", "gif", "jp2", "pict", "bmp", "qtif", "psd", "sgi", "tga"}
	set chosenType to (choose from list supportedTypes with prompt "Choose new file type:") as text
	set theCommand to "sips -s format " & chosenType & space & originalFile & " --out '" & newFile & "." & chosenType & "'" as string
		do shell script theCommand
	on error number errNum
		display dialog errNum
	end try
end run

[ Reply to This | # ]
Sips also converts from other formats to ICNS
Authored by: clydeps on Nov 14, '11 12:28:03PM

Not only can sips convert from .icns files, but it can also create .icns files, e.g.

sips -s format icns file.png --out file.icns

will create file.icns from the input png file.

[ Reply to This | # ]