CgIcon objects are unloaded into files using the same methods as for images. However, as with the icon load methods, an array of CgIcons is given, rather than a single CgIcon.
The following code unloads a single icon into a file in the Windows ICO format. It assumes that the iconToUnload method answers the CgIcon to unload.
| icons format | icons := Array with: self iconToUnload. format := CgWinICOFileFormat new. (format unload: icons intoFile: 'icon-out.ico') ifFalse: [self error: 'Error unloading icon']