Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone get image width and size

I am new to iPhone programming. I want to get the height and width of a image, so I can set the frame of UIImageview accordingly. Any suggestions how can I get the original size (width and height) of image?

like image 305
Rupesh Avatar asked Nov 04 '09 11:11

Rupesh


People also ask

How do you see the length and the width of a photo?

Right-click the image whose size you want to know and select Inspect. View your image's width and height displayed in the Chrome DevTools. (Note, the first number is always the width). If your image is not highlighted by default, click the inspect element button.


1 Answers

Well, if you have the image as UIImage, then you want to take a look at the size property:

CGFloat width = myImage.size.width;
CGFloat height = myImage.size.height;
like image 110
Pascal Avatar answered Sep 25 '22 16:09

Pascal