비트맵 처리
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Compose 방식 사용해 보기
Jetpack Compose는 Android에 권장되는 UI 도구 키트입니다. Compose에서 그래픽을 표시하는 방법을 알아보세요.
Android 앱에서 비트맵을 로드하는 것이 까다로운 데에는 다음과 같은 몇 가지 이유가 있습니다.
- 비트맵은 앱의 메모리 예산을 매우 쉽게 소모할 수 있습니다. 예를 들어, Pixel 스마트폰의 카메라는 최대 4048x3036 픽셀(12 메가픽셀)의 사진을 찍습니다.
사용된 비트맵 구성이
ARGB_8888
인 경우 Android 2.3(API 수준 9) 및 이후 버전에서 사진 한 장을 메모리로 로드하는 데 기본적으로 약 48MB(4048*3036*4 바이트)의 메모리가 소모됩니다. 이렇게 대량의 메모리를 요구하면 앱에서 사용할 수 있는 모든 메모리가 즉시 소모될 수 있습니다.
- 비트맵을 UI 스레드로 로드하면 앱의 성능이 저하되어 응답이 느려지거나 ANR 메시지가 전송될 수 있습니다. 따라서 비트맵을 사용할 때는 스레드를 적절하게 관리하는 것이 중요합니다.
- 앱이 메모리에 여러 개의 비트맵을 로드한다면 메모리와 디스크 캐싱을 능숙하게 관리해야 합니다. 그러지 않으면, 앱 UI의 반응 능력과 유동성에 좋지 않은 영향을 미칠 수 있습니다.
대부분의 경우 Glide 라이브러리를 사용하여 앱에서 비트맵을 가져오고 디코딩하고 표시하는 것을 추천합니다. Glide는 이러한 작업을 비롯하여, Android에서 비트맵과 기타 이미지를 사용하는 것과 관련된 다른 작업을 처리할 때 대부분의 복잡성을 추상화합니다.
Glide 사용 및 다운로드에 관한 자세한 내용은 GitHub의 Glide 저장소를 참고하세요.
Android 프레임워크에 내장된 하위 레벨 API를 이용하여 직접 작업할 수도 있습니다.
이 작업에 관한 자세한 내용은 큰 비트맵을 효율적으로 로드, 비트맵 캐싱 및 비트맵 메모리 관리를 참고하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-26(UTC)"],[],[],null,["# Handling bitmaps\n\nTry the Compose way \nJetpack Compose is the recommended UI toolkit for Android. Learn how to display graphics in Compose. \n[ImageBitmap →](/jetpack/compose/graphics/images/compare) \n\nThere are a number of reasons why loading bitmaps in your Android app is tricky:\n\n- Bitmaps can very easily exhaust an app's memory budget. For example, the camera on the [Pixel](https://www.android.com/phones/pixel/) phone takes photos of up to 4048x3036 pixels (12 megapixels). If the bitmap configuration used is [ARGB_8888](/reference/android/graphics/Bitmap.Config), the default for Android 2.3 (API level 9) and higher, loading a single photo into memory takes about 48MB of memory (4048\\*3036\\*4 bytes). Such a large memory demand can immediately use up all the memory available to the app.\n- Loading bitmaps on the UI thread can degrade your app's performance, causing slow responsiveness or even ANR messages. It is therefore important to manage threading appropriately when working with bitmaps.\n- If your app is loading multiple bitmaps into memory, you need to skillfully manage memory and disk caching. Otherwise, the responsiveness and fluidity of your app's UI may suffer.\n\n\nFor most cases, we recommend that you use the [Glide](https://github.com/bumptech/glide)\nlibrary to fetch, decode, and display bitmaps in your app. Glide abstracts out most of\nthe complexity in handling these and\nother tasks related to working with bitmaps and other images on Android.\nFor information about using and downloading Glide, visit the\n[Glide repository](https://github.com/bumptech/glide) on GitHub.\n\n\nYou can also opt to work directly with the lower-level APIs built into the Android framework.\nFor more information on doing so, refer to\n[Loading Large Bitmaps Efficiently](/topic/performance/graphics/load-bitmap),\n[Caching Bitmaps](/topic/performance/graphics/cache-bitmap), and\n[Managing Bitmap Memory](/topic/performance/graphics/manage-memory).\n\nMore resources\n--------------"]]