Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get width and height of the image?

Tags:

HI,

I want to get width and height of the image which i was stored in the drawable folder. Is this possible, if so please let me know ?

like image 240
ramsbh Avatar asked Dec 29 '10 09:12

ramsbh


People also ask

What is width and height of an image?

The Image Height is one part of the information that determines a picture's, photo's or other image's dimension. Together with the image width, this value determines the size of an image itself, not the file size. Often, Image Height is given in pixels, e.g. 682 px.

How do I find out the size of an image?

If you right-click an image file in Windows Explorer and select Properties, you obtain the image information with the pixel size. You can see how many pixels the image is made up of, and the image resolution.


2 Answers

try

BitmapDrawable bd=(BitmapDrawable) this.getResources().getDrawable(R.drawable.icon); int height=bd.getBitmap().getHeight(); int width=bd.getBitmap().getWidth(); 
like image 149
Jett Hsieh Avatar answered Nov 17 '22 18:11

Jett Hsieh


I have follow this link :-

Drawable d = getResources().getDrawable(R.drawable.yourimage); int h = d.getIntrinsicHeight(); int w = d.getIntrinsicWidth(); 
like image 24
duggu Avatar answered Nov 17 '22 17:11

duggu