将 CGImageRef 保存到 png 文件? [英] Saving CGImageRef to a png file?
本文介绍了将 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屋!
查看全文