How to merge two UIImages?

后端 未结 7 1624
野趣味
野趣味 2020-12-07 16:57

I am trying to merge two different images and create a new one. This is the way I would like to do: I have this image (A):

It\'s a PNG image and I would like to mer

7条回答
  •  情深已故
    2020-12-07 17:13

    This way the overlay picture will be much cleaner

    class func mergeImages(imageView: UIImageView) -> UIImage {
     UIGraphicsBeginImageContextWithOptions(imageView.frame.size, false, 0.0) 
     imageView.superview!.layer.renderInContext(UIGraphicsGetCurrentContext()!)
     let image = UIGraphicsGetImageFromCurrentImageContext()
     UIGraphicsEndImageContext()
    
     return image 
    }
    

提交回复
热议问题