Programming/Android

[Android] 파일을 bitmap으로 만들지않고 width와 height값 가져오기

By훈트 2011. 1. 28. 12:18

01./** Get Bitmap's Width **/
02.public static int getBitmapOfWidth( String fileName ){
03.try {
04.BitmapFactory.Options options = new BitmapFactory.Options();
05.options.inJustDecodeBounds = true;
06.BitmapFactory.decodeFile(fileName, options);
07.return options.outWidth;
08.catch(Exception e) {
09.return 0;
10.}
11.}
12. 
13./** Get Bitmap's height **/
14.public static int getBitmapOfHeight( String fileName ){
15. 
16.try {
17.BitmapFactory.Options options = new BitmapFactory.Options();
18.options.inJustDecodeBounds = true;
19.BitmapFactory.decodeFile(fileName, options);
20. 
21.return options.outHeight;
22.catch(Exception e) {
23.return 0;
24.}
25.}

[출처] 안드로이드펍 SSamDDak님의 답변