Bitmap size problem

Started by
0 comments, last by Zael 12 years ago
Hi! I'm trying to load a .PNG image from the SD card (OS: android 2.2). It loads ok, but when I check the size, it's a little smaller than the original (the original size is 36x36 and the loaded is 27x27 bits, also looks smaller in the screen)

This is what I'm using to load the image

this.bmp = BitmapFactory.decodeResource(this.game.getResources(),this.id);
if(bmp==null)
System.out.println("Cannot load the image");
this.pixelsX = bmp.getWidth();
this.pixelsY = bmp.getHeight();

Also, if I load a 24x24 image, pixelsX & pixelsY get 18 each one.
Is this somethig decodeResource do by itself? I need it to be the right size for each bitmap.

Hope you can help me ;)
Advertisement
I may be wrong, but I seem to remember some automatic resizing that took place when I loaded images like that in my Android game. Most image files have a PPI (pixels per inch) value, and if I recall that method resizes the image so that it is the same physical size by comparing the image's PPI and the device's PPI.

This topic is closed to new replies.

Advertisement