Jump to content
  • Advertisement
Sign in to follow this  
elle_lawliet

Bitmap size problem

This topic is 2287 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!