Objective-C - 将图像转换为 icns [英] Objective-C - Convert an image to icns
问题描述
我正在尝试为 Mac OS X 创建一个将图像类型转换为 icns 文件的应用程序.我想知道如何才能开始这样做.任何建议都会很好!
I am trying to create an app for the Mac OS X that will convert an image type to an icns file. I'm wondering how I can get started on doing so. Any suggestions would be nice!
谢谢,
凯文
推荐答案
使用 CGImageSource API(例如,CGImageSourceCreateWithURL
、CGImageSourceCreateImageAtIndex
)将每个图像加载到 CGImageRef
.然后使用 CGImageDestination API(例如,CGImageDestinationCreateWithURL
、CGImageDestinationAddImage
、CGImageDestinationFinalize
)将您拥有的许多图像组合到一个图标文件中.CGImageDestinationCreateWithURL
的第三个参数是 kUTTypeAppleICNS
.
Use CGImageSource APIs (e.g., CGImageSourceCreateWithURL
, CGImageSourceCreateImageAtIndex
) to load each image into a CGImageRef
. Then use CGImageDestination APIs (e.g., CGImageDestinationCreateWithURL
, CGImageDestinationAddImage
, CGImageDestinationFinalize
) to combine however many images you have into one icon file. The 3rd parameter of CGImageDestinationCreateWithURL
would be kUTTypeAppleICNS
.
这篇关于Objective-C - 将图像转换为 icns的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!