Image size on Objective-c,

how to get image size in objecive-c,

i uploaded a single image using imagePicker, I want to know the size of this image. (W * H)

It is possible.

Thank you and welcome ...

+3
source share
1 answer

You are implementing the UIImagePickerControllerDelegate Protocol and, in particular, the method imagePickerController:didFinishPickingMediaWithInfo:. The last parameter in this method is a dictionary, which includes UImage links using the key UIImagePickerControllerOriginalImage. Get this UIImage * and get its property size.

- (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;
}
+8
source

Source: https://habr.com/ru/post/1776234/


All Articles