照片库中图像的分辨率始终为640 * 480

时间:2010-10-21 06:45:58

标签: iphone

我正在开发一个模块,我需要从照片库中选择图像并在视图上绘图。但是每当我选择大尺寸图像时,它总会返回640 * 480缩放图像,因为显示的是小图像。 / p>

我已将AllowEditing设为ON。

任何人都可以帮我找到原始图像的分辨率,这样我就可以再次将其缩放到原始图像。

iImagePicker.allowsImageEditing = YES;

- (void)imagePickerController:(UIImagePickerController *)picker 
        didFinishPickingImage:(UIImage *)image
                  editingInfo:(NSDictionary *)editingInfo
{

    [[iImagePicker parentViewController] dismissModalViewControllerAnimated:YES];  
    iIsImageSaved = YES;
    iSavedImage = [editingInfo objectForKey:@"UIImagePickerControllerOriginalImage"];;
    int width,height;
    width = iSavedImage.size.width;
    height = iSavedImage.size.height;

    iApp->ImagePicked(image);
}

谢谢,

Sagar的

1 个答案:

答案 0 :(得分:1)

您无需缩放图像,无论如何都应该可用。检查我对this question的回答(我认为这是重复的。)


[更新了代码的答案] 您使用的是deprecated method,请使用imagePickerController:didFinishPickingMediaWithInfo:密钥尝试UIImagePickerControllerOriginalImage


添加了代码段:

-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    UIImage* originalImage = [info objectForKey:UIImagePickerControllerOriginalImage];
    NSLog(@"Original image width: %f and height: %f", originalImage.size.width, originalImage.size.height);

    UIImage* editedImage = [info objectForKey:UIImagePickerControllerEditedImage];
    NSLog(@"Edited image width: %f and height: %f", editedImage.size.width, editedImage.size.height);

    [self dismissModalViewControllerAnimated:YES];
}