将捕获的图像与覆盖图像一起保存到iphone中的相册中
如何合并从UIImagePickerController和cameraoverlay视图捕获的照片? 然后我想把它保存到相册中将捕获的图像与覆盖图像一起保存到iphone中的相册中,iphone,uiimagepickercontroller,Iphone,Uiimagepickercontroller,如何合并从UIImagePickerController和cameraoverlay视图捕获的照片? 然后我想把它保存到相册中 需要这方面的帮助。我认为这可能有助于使用相机覆盖视图并将覆盖单击的图像保存到库中我认为这可能有助于使用相机覆盖视图并将覆盖单击的图像保存到库中很抱歉,我之前没有收到您的问题。。一种方法是以编程方式捕获屏幕截图,然后根据需要编辑图像并保存 这应该有助于。。。 很抱歉,我没有早点回答你的问题。。一种方法是以编程方式捕获屏幕截图,然后根据需要编辑图像并保存 这应该有助于。。。
需要这方面的帮助。我认为这可能有助于使用相机覆盖视图并将覆盖单击的图像保存到库中我认为这可能有助于使用相机覆盖视图并将覆盖单击的图像保存到库中很抱歉,我之前没有收到您的问题。。一种方法是以编程方式捕获屏幕截图,然后根据需要编辑图像并保存 这应该有助于。。。
很抱歉,我没有早点回答你的问题。。一种方法是以编程方式捕获屏幕截图,然后根据需要编辑图像并保存 这应该有助于。。。
我将创建一个图像上下文,然后将两个图像都写入其中。然后使用UIImageWriteToSavedPhotosAlbum保存到相册。下面是一个示例,当从按钮调用时,我在保存的图像上放置了一个徽标。在您的情况下,品牌图像将是您的覆盖,imageToSave将是来自UIImagePickerController的图像。修改以适应。希望这将有助于:
- (IBAction)saveImage:(id)sender{
//add brand to image
UIImage *BrandImage = [UIImage imageNamed:@"brand.png"];
UIImage* imageToSave = [imageView image]; //get current imageView
CGSize targetSize = CGSizeMake(self.imageView.image.size.width, self.imageView.image.size.height);
CGRect imageRect = CGRectMake(0, 0, self.imageView.image.size.width, self.imageView.image.size.height);
//get screen size for retina or non retina
UIScreen *MainScreen = [UIScreen mainScreen];
UIScreenMode *ScreenMode = [MainScreen currentMode];
CGSize Size = [ScreenMode size];
//position brand logo according to screen size
if (Size.width == 640) {
topImageRect = CGRectMake(self.imageView.image.size.width - 160, self.imageView.image.size.height - 80, 141, 53);
}
else
{
topImageRect = CGRectMake(self.imageView.image.size.width - 80, self.imageView.image.size.height - 40, 71, 27);
}
UIGraphicsBeginImageContext(targetSize);
CGContextRef context = UIGraphicsGetCurrentContext();
UIGraphicsPushContext(context);
[imageToSave drawInRect:imageRect];
[BrandImage drawInRect:topImageRect];
UIGraphicsPopContext();
// get a UIImage from the image context
UIImage* SavedImage = UIGraphicsGetImageFromCurrentImageContext();
// clean up drawing environment
UIGraphicsEndImageContext();
// Save it to the camera roll / saved photo album
UIImageWriteToSavedPhotosAlbum(SavedImage, nil, nil, nil);
}
我将创建一个图像上下文,然后将两个图像都写入其中。然后使用UIImageWriteToSavedPhotosAlbum保存到相册。下面是一个示例,当从按钮调用时,我在保存的图像上放置了一个徽标。在您的情况下,品牌图像将是您的覆盖,imageToSave将是来自UIImagePickerController的图像。修改以适应。希望这将有助于:
- (IBAction)saveImage:(id)sender{
//add brand to image
UIImage *BrandImage = [UIImage imageNamed:@"brand.png"];
UIImage* imageToSave = [imageView image]; //get current imageView
CGSize targetSize = CGSizeMake(self.imageView.image.size.width, self.imageView.image.size.height);
CGRect imageRect = CGRectMake(0, 0, self.imageView.image.size.width, self.imageView.image.size.height);
//get screen size for retina or non retina
UIScreen *MainScreen = [UIScreen mainScreen];
UIScreenMode *ScreenMode = [MainScreen currentMode];
CGSize Size = [ScreenMode size];
//position brand logo according to screen size
if (Size.width == 640) {
topImageRect = CGRectMake(self.imageView.image.size.width - 160, self.imageView.image.size.height - 80, 141, 53);
}
else
{
topImageRect = CGRectMake(self.imageView.image.size.width - 80, self.imageView.image.size.height - 40, 71, 27);
}
UIGraphicsBeginImageContext(targetSize);
CGContextRef context = UIGraphicsGetCurrentContext();
UIGraphicsPushContext(context);
[imageToSave drawInRect:imageRect];
[BrandImage drawInRect:topImageRect];
UIGraphicsPopContext();
// get a UIImage from the image context
UIImage* SavedImage = UIGraphicsGetImageFromCurrentImageContext();
// clean up drawing environment
UIGraphicsEndImageContext();
// Save it to the camera roll / saved photo album
UIImageWriteToSavedPhotosAlbum(SavedImage, nil, nil, nil);
}
谢谢你的回复。但是我正在使用UIImagePickerController来捕获照片。你对这个代替AVFoundation有什么想法吗?那么你也可以试试这个。谢谢你的回复。但是我正在使用UIImagePickerController来捕获照片。你对这个代替AVFoundation有什么想法吗?那么你也可以试试这个。谢谢你的回复您的回答。它将只保存捕获的图像。但是我想用覆盖图像保存捕获的图像。谢谢您的回答。它将只保存捕获的图像。但是我想用覆盖图像保存捕获的图像。