검색결과 리스트
안드로이드에 해당되는 글 2건
- 2011.10.20 createScaledBitmap 사용시 OutOfMemoryError 가 난다면? 36
- 2010.07.06 안드로이드는 OS 이다. 30
안드로이드에는 이미지크기를 줄일때 Bitmap.createScaledBitmap() 이라는 유용한 함수를 제공해 줍니다.
함수원형을 보면 아래와 같습니다.
여기서 문제는 Bitmap 소스가 들어가야 한다는 것입니다.
public static Bitmap createScaledBitmap (Bitmap src, int dstWidth, int dstHeight, boolean filter)
위와 같이 사용해야 합니다.
Bitmap tempBitmap = BitmapFactory.decodeStream(new FileInputStream(bitmapFile), null, resizeOpts);
Bitmap finalBitmap = Bitmap.createScaledBitmap(tempBitmap, dimen[0], dimen[1], false);
이것은 디코딩을 할때 원본크기의 1/2 로 디코딩하라는 말입니다.
BitmapFactory.Options resizeOpts = new Options();
resizeOpts.inSampleSize = 2;
Bitmap tempBitmap = BitmapFactory.decodeStream(new FileInputStream(bitmapFile), null, resizeOpts);
Bitmap finalBitmap = Bitmap.createScaledBitmap(tempBitmap, dimen[0], dimen[1], false);
maven 을 이용한 android 설정파일 관리 (300) | 2012.01.25 |
---|---|
maven 을 이용한 android 자동 빌드환경 구성 (28) | 2012.01.25 |
android 에서 xml 을 이용해 이미지 전환 효과주기 (81) | 2011.07.14 |
android 에서 xml 을 이용한 animation 처리 (32) | 2011.07.14 |
안드로이드 ListView 에서 Holder 패턴을 이용한 View 의 재활용 (45) | 2011.06.27 |
RECENT COMMENT