Android.graphics.BitmapFactory.Options
lastmod 2026-11-10created 2016-05-272 edits
android.graphics.BitmapFactory.Options is a settings class that controls behavior when decoding images with BitmapFactory. Turning on inJustDecodeBounds lets you find out only the width and height without reading the pixels, and specifying a downscaling ratio with inSampleSize loads a large image shrunk to fit in memory. In addition, inPreferredConfig sets the pixel format; it is the key means of avoiding OutOfMemoryError when handling large images.