osxiconutils is a set of Mac OS X command line utilities for retrieving, setting, converting and working with Mac OS X icons. The software package contains the following tools:
seticon- set the custom icon of Mac OS X files or folders from either
icnsor image files
geticon- retrieve the icon of a given Mac OS X file or folder as an
pic2icns- convert an image file to a Mac OS X
icns2pic- convert a Mac OS X
icnsfile into a standard image file (i.e. JPEG, GIF etc.)
You will need to build these tools yourself once you have downloaded the code archive. An XCode project is included along with the source code, which is provided under the terms and conditions of the Free Software Foundation's GNU General Public License. These tools make use of Troy Stephens' excellent IconFamily class and are written in C/Objective C.
I haven't created man pages or documentation for these tools, but their usage should be obvious by passing them the -h option, which will display the help for each individual tool.