tags:

views:

46

answers:

1

Hello All,

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:(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);
}

Thanks,

Sagar

+1  A: 

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];
}
Irene
I tried with that link but still I get the size 640 * 480. I have updated post with my src code.
Sagar Mane
check my edited answer
Irene
I have updated src code with - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ //UIImage* image = nil; [[iImagePicker parentViewController] dismissModalViewControllerAnimated:YES]; iIsImageSaved = YES; iSavedImage = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; int width,height; width = iSavedImage.size.width; height = iSavedImage.size.height; iApp->ImagePicked(iSavedImage);}But still I am getting same result. I am checking it on 4th Gen iPod with 4.1 OS.
Sagar Mane
Check this quick code snippet (and please try to increase your accept rate, or else people might not want to help you..)
Irene