LoginSignup
6
4

More than 5 years have passed since last update.

Bitmapのサイズをメモリ上に展開せずに知る

Last updated at Posted at 2013-02-07

BitmapFactory.OptionsのinJustDecodeBoundsにtrueを指定してやる。
- outWidth(横幅)、outHeight(縦幅)、outMimeType(MIMEタイプ)などがとれる。
- http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html

sample.java
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResources(), resourceId, options); 
Log.d(TAG, "width:" + options.outWidth + ", height:" + options.outHeight);
6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4