swift 照片拼接 代码片段

    func addImage(image1:UIImage ,toImage image2:UIImage )->UIImage {

            UIGraphicsBeginImageContext(image1.size);

    // Draw image1

        image1.draw(in: CGRect.init(x: 0, y: 0, width: image1.size.width, height: image1.size.height));

    // Draw image2

    image2.draw(in: CGRect.init(x: 0, y: 0, width: image2.size.width, height: image2.size.height));

            let resultingImage = UIGraphicsGetImageFromCurrentImageContext();

        UIGraphicsEndImageContext();

            return resultingImage! ;

    }

猜你喜欢

转载自blog.csdn.net/qq_30126571/article/details/85089385