简体   繁体   中英

image size on Objective-c,

how to get Image size in objecive-c,

i loaded one image using imagePicker, i want know the size of that image. (w*h)

is it possible. ?

Thanks & regards...

You implement the UIImagePickerControllerDelegate Protocol and in particular the imagePickerController:didFinishPickingMediaWithInfo: method. The last parameter in that method is a dictionary that includes an UImage references by the UIImagePickerControllerOriginalImage key. Get this UIImage* and get it's size property.

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    UIImage *image = (UIImage*) [info objectForKey:UIImagePickerControllerOriginalImage];
    //access width and height like this
    image.size.width;
    image.size.height;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM