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

查看:192
本文介绍了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!

谢谢,

Kevin

推荐答案

使用CGImageSource API(例如, CGImageSourceCreateWithURL CGImageSourceCreateImageAtIndex )将每个图像加载到 CGImageRef 。然后使用CGImageDestination API(例如, CGImageDestinationCreateWithURL CGImageDestinationAddImage CGImageDestinationFinalize )将您拥有的许多图像合并到一个图标文件中。 CGImageDestinationCreateWithURL 的第3个参数是 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天全站免登陆