当我从iOS应用程序通过设备拍照时,我想显示3张照片,如最小变焦(2),中间变焦(4),最大变焦(6)。
Ex:我想从应用中拍照。选择照片后,显示三张不同缩放的照片。
答案 0 :(得分:1)
您可以使用UIImage
类的-imageWithData:scale:
方法来适当缩放图像。
只需从-imagePickerController: didFinishPickingMediaWithInfo
获取图片并将其转换为行数据,然后您就可以轻松地将数据对象传递给所需的比例到-imageWithData:scale:
类的UIImage
方法。
就是这样。
答案 1 :(得分:0)
#pragma - mark Selecting Image from Camera and Library
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo (NSDictionary *)info
{
// Picking Image from Camera/ Library
[picker dismissViewControllerAnimated:YES completion:^{}];
UIImage *img= [info objectForKey:@"UIImagePickerControllerOriginalImage"];
if (!img)
{
return;
}
// Adjusting Image Orientation
NSData *data = UIImagePNGRepresentation(img);
UIImage *tmp = [UIImage imageWithData:data];
UIImage *fixed = [UIImage imageWithCGImage:tmp.CGImage
scale:img.scale
orientation:img.imageOrientation];
img = fixed;
}
答案 2 :(得分:0)
您可以使用此
your_image_view.transform = CGAffineTransformScale(your_image_view.transform, 2.0, 2.0);