Objective-C - 将图像转换为 icns [英] Objective-C - Convert an image to icns

查看:40
本文介绍了Objective-C - 将图像转换为 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(例如,CGImageSourceCreateWithURLCGImageSourceCreateImageAtIndex)将每个图像加载到 CGImageRef.然后使用 CGImageDestination API(例如,CGImageDestinationCreateWithURLCGImageDestinationAddImageCGImageDestinationFinalize)将您拥有的许多图像组合到一个图标文件中.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆