How to create a ICNS icon programmatically?

好久不见. 提交于 2019-12-04 12:06:31

You can use IconFamily.

IconFamily is a Cocoa/Objective-C wrapper for the Mac OS X Carbon API's "icon family" data type. Its main purpose is to enable Cocoa applications to easily create custom file icons from NSImage instances, and thus take advantage of Mac OS X's high-resolution RGBA "thumbnail" icon formats to provide richly detailed thumbnail previews of the files' contents.

NSImage *mImage = [[NSImage alloc] initWithContentsOfFile:@"/Users/Username/Desktop/WhiteTiger.jpg"];
IconFamily *fam = [IconFamily iconFamilyWithThumbnailsOfImage:mImage];    
[fam writeToFile:@"/Users/Username/Desktop/WhiteTiger.icns"];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!