Sign in to follow this  
elle_lawliet

Bitmap size problem

Recommended Posts

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 ;)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this