将CGImageRef保存到png文件? [英] Saving CGImageRef to a png file?

查看:276
本文介绍了将CGImageRef保存到png文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Cocoa应用程序,我从磁盘加载一个.jpg文件,操纵它。现在它需要作为.png文件写入磁盘。

in my Cocoa application, I load a .jpg file from disk, manipulate it. Now it needs to be written to disk as a .png file. How can you do that?

感谢您的帮助!

推荐答案

创建 CGImageDestination ,传递 kUTTypePNG 作为要创建的文件类型。添加图片,然后完成目的地。

Create a CGImageDestination, passing kUTTypePNG as the type of file to create. Add the image, then finalize the destination.

这篇关于将CGImageRef保存到png文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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