Saving CGImageRef to a png file?

前端 未结 3 1052
天涯浪人
天涯浪人 2020-11-30 00:28

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?

Thanks for your help!

3条回答
  •  天命终不由人
    2020-11-30 01:21

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

提交回复
热议问题