【问题标题】:How to combine drawn pixels in a UIView with the image in a UIImageView and save it as a new image?如何将 UIView 中绘制的像素与 UIImageView 中的图像结合起来,并将其保存为新图像?
【发布时间】:2012-04-12 15:25:40
【问题描述】:

我想知道如何将 UIView 中的绘制像素与 UIImageView 中的图像结合起来并将其保存为新图像?我不知道该怎么做。

如果有人能指出我正确的方向,我会喜欢的。

谢谢!

【问题讨论】:

    标签: objective-c ios uiview uiimageview


    【解决方案1】:

    查看Quartz 2D。具体来说,CGContextDrawImage() 可用于加载图像,在此上下文中绘制您想要的任何内容,然后您可以CGBitmapContextCreateImage() 创建一个CGImageRef,您可以从中使用UIImageimageWithCGImage 创建图像.最后,您使用UIImagePngRepresentation()UIImageJPEGRepresentation() 获取一个NSData,然后您可以使用writeToFile

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-21
      • 1970-01-01
      • 1970-01-01
      • 2015-06-21
      • 2015-04-11
      • 1970-01-01
      相关资源
      最近更新 更多