Hi i am creating a Bitmap from an png image named image.png
. The image has the dimension 75 (width) x 92 (height). When I run this code:
Bitmap bitmap = BitmapFactory.decodeResource(this.context.getResources(), R.drawable.image
Log.d("image", "height: " + bitmap.getHeight() + " width: " + bitmap.getWidth());
the logger logs:
DEBUG/image(3550): height: 138 width: 113
and the image on the screen is bigger than other images which have the dimension 75 x 92. What can I do to make android load the image with the right dimension?
My solution:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = false;
Bitmap bitmap = BitmapFactory.decodeResource(this.context.getResources(), R.drawable.image, options );