Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image size on Objective-C

How to get Image size in Objective-C.

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

is it possible?

Thanks & regards...

like image 396
jaleel Avatar asked Dec 02 '25 21:12

jaleel


1 Answers

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;
}
like image 136
brain Avatar answered Dec 04 '25 11:12

brain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!