I loaded a 640 x 480 (in px) jpg image from res using Bitmap.
bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.bmp);
But I found:
- the value of bitmap.getWitdh() is 1280;
- the value of bitmap.getHeight() is 960;
- the value of bitmap.getRowBytes() is 2560;
Why?
That depends on your mobile phone. Since android supports multiple screens, in order to allow bitmap to scale in the same way across different screens the original bitmap is stored in order to meet the density of your screen. Given the value you posted seems that your mobile has an xdpi screen. Probably getHeight() and getWidth would have you return 480 and 640 if you mobile had been an mdpi. See here for more info