18
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

画像を読み込まずに高さ/幅を取得する

Last updated at Posted at 2012-03-16

読み込まないので負荷をかけににくい。

getBitmapSize.java
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inJustDecodeBounds = true;//これが読み込まないオプション
Bitmap preBitmap = null;
InputStream preIStream = new FileInputStream(path);
preBitmap = BitmapFactory.decodeStream(preIStream, null, opts);
preIStream.close();

int bmW = opts.outWidth ;//画像のwidth
int bmH = opts.outHeight ;//画像のheight        
18
18
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
18
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?