gpt4 book ai didi

ios - 将多个图像合并为单个图像

转载 作者:行者123 更新时间:2023-12-01 16:35:10 25 4
gpt4 key购买 nike

我想在保存到相机胶卷的同时将多个图像合并为单个图像。
实际上,我在不同的 View 中有不同的图像。我在一个 View 中有 3 个图像,在选择具有 4 个框架的布局时也有 4 个图像。有人帮助我如何合并它们。

我的分享代码:

 CGRect rect=[self.previewView bounds];
UIGraphicsBeginImageContextWithOptions(rect.size, YES, 0.0f);
CGSize size=CGSizeMake(self.previewView.frame.size.width, self.previewView.frame.size.height);
if(selectButtonTag==2)
{
[self.doubleFrameViewcapturedImg1.image drawInRect:CGRectMake(0, 0, size.width, size.height)blendMode:kCGBlendModeNormal alpha:0.5];
[self.doubleFrameViewcapturedImg2.image drawInRect:CGRectMake(0,0,size.width,size.height) blendMode:kCGBlendModeNormal alpha:0.5];
}
CGContextRef context=UIGraphicsGetCurrentContext();
[self.previewView.layer renderInContext:context];
UIImage *newImage=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSArray *activity=[[NSArray alloc]initWithObjects:UIActivityTypeCopyToPasteboard,
UIActivityTypeMail,
UIActivityTypeMessage,
UIActivityTypePostToFacebook,
UIActivityTypePostToTwitter,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAirDrop
, nil];
UIActivityViewController *ShareView=[[UIActivityViewController alloc]initWithActivityItems:@[newImage,activity] applicationActivities:nil];
ShareView.popoverPresentationController.sourceView=self.view;
[self presentViewController:ShareView animated:YES completion:nil];

enter image description here

最佳答案

您可以使用 CoreGraphics 来执行此操作,更多细节请按照 CodeTutePlus AdvancedImageTechnicsCoreGraphics 的教程进行操作

关于ios - 将多个图像合并为单个图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28936831/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com