1

I am loading some image using

    Resources resources = WatchFaceService.this.getResources();
    Drawable spritesDrawable = resources.getDrawable(R.drawable.sprites);
    mSpritesBitmap = ((BitmapDrawable)spritesDrawable).getBitmap();

R.drawable.sprites is a 640x700 PNG, yet

    Log.d( TAG, "SpritesBitmap=" + mSpritesBitmap.getWidth() + "x" + mSpritesBitmap.getHeight());

outputs 960x1050

Where does the 1.5 scale come from?

MonoThreaded
  • 11,429
  • 12
  • 71
  • 102
  • 1
    Android sometimes scales Bitmaps when you load them, did you try loading it diffrently? like this for example: http://stackoverflow.com/questions/6805355/i-dont-want-android-to-resize-my-bitmap-automatically – Alexanus Mar 30 '15 at 12:06
  • 1
    That was indeed related to resource path. Moving the PNG file to drawables-nodpi did the trick. Please post as answer. – MonoThreaded Mar 30 '15 at 13:30

1 Answers1

1

Android sometimes scales Bitmaps when you load them, did you try loading it differently?

For clarity, if your resource is located in ./drawable/ they may end up scaled
You can prevented this by moving the resource to ./drawable-nodpi/

see: I don't want Android to resize my bitmap Automatically

Community
  • 1
  • 1
Alexanus
  • 679
  • 4
  • 22