开发者

Resolution of image from photo library is always 640 * 480

开发者 https://www.devze.com 2023-01-21 05:42 出处:网络
I am working on one module where I need to pick image from photo library and draw on view.but whenever I pick the large scale images it always return me 640 *480 scaled image and because of that small

I am working on one module where I need to pick image from photo library and draw on view.but whenever I pick the large scale images it always return me 640 *480 scaled image and because of that small image is displayed.

I have made AllowEditing ON.

can anyone help me to find the resolution of original image,so that I can again scale it to original one.

iImagePicker.allowsImageEditing = YES;

- (void)imagePickerController:(开发者_如何学JAVAUIImagePickerController *)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);
}

Thanks,

Sagar


You don't need to scale your image back, it should be available anyway. Check my answer to this question (which is a duplicate I think..)


[Updated answer for your code] You are using a deprecated method, try imagePickerController:didFinishPickingMediaWithInfo: with the UIImagePickerControllerOriginalImage key instead.


Added code snippet:

-(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];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消