美文网首页iOS开发
iOS---将两张照片合并为一张照片

iOS---将两张照片合并为一张照片

作者: 彬至睢阳 | 来源:发表于2018-10-28 11:34 被阅读0次

- (UIImage*)addImage:(UIImage*)image1 toImage:(UIImage*)image2

{

    //将底部的一张的大小作为所截取的合成图的尺寸

     UIGraphicsBeginImageContext(CGSizeMake(image2.size.width, image2.size.height+image1.size.height));

    // Draw image2,底下的

    [image2drawInRect:CGRectMake(0, 0, image2.size.width, image2.size.height)];

    [image1drawInRect:CGRectMake(0,image2.size.height, image1.size.width, image1.size.height)];

    UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    returnresultingImage;

}

相关文章

网友评论

    本文标题:iOS---将两张照片合并为一张照片

    本文链接:https://www.haomeiwen.com/subject/qpeqtqtx.html