Skip to content

Most visited

Recently visited

navigation

Bitmap.Config

public static final enum Bitmap.Config
extends Enum<Bitmap.Config>

java.lang.Object
   ↳ java.lang.Enum<android.graphics.Bitmap.Config>
     ↳ android.graphics.Bitmap.Config


Possible bitmap configurations. A bitmap configuration describes how pixels are stored. This affects the quality (color depth) as well as the ability to display transparent/translucent colors.

Summary

Enum values

Bitmap.Config  ALPHA_8

Each pixel is stored as a single translucency (alpha) channel. 

Bitmap.Config  ARGB_4444

This field was deprecated in API level 13. Because of the poor quality of this configuration, it is advised to use ARGB_8888 instead.  

Bitmap.Config  ARGB_8888

Each pixel is stored on 4 bytes. 

Bitmap.Config  RGB_565

Each pixel is stored on 2 bytes and only the RGB channels are encoded: red is stored with 5 bits of precision (32 possible values), green is stored with 6 bits of precision (64 possible values) and blue is stored with 5 bits of precision. 

Public methods

static Bitmap.Config valueOf(String name)
static final Config[] values()

Inherited methods

From class java.lang.Enum
From class java.lang.Object
From interface java.lang.Comparable

Enum values

ALPHA_8

Added in API level 1
Bitmap.Config ALPHA_8

Each pixel is stored as a single translucency (alpha) channel. This is very useful to efficiently store masks for instance. No color information is stored. With this configuration, each pixel requires 1 byte of memory.

ARGB_4444

Added in API level 1
Bitmap.Config ARGB_4444

This field was deprecated in API level 13.
Because of the poor quality of this configuration, it is advised to use ARGB_8888 instead.

Each pixel is stored on 2 bytes. The three RGB color channels and the alpha channel (translucency) are stored with a 4 bits precision (16 possible values.) This configuration is mostly useful if the application needs to store translucency information but also needs to save memory. It is recommended to use ARGB_8888 instead of this configuration. Note: as of KITKAT, any bitmap created with this configuration will be created using ARGB_8888 instead.

ARGB_8888

Added in API level 1
Bitmap.Config ARGB_8888

Each pixel is stored on 4 bytes. Each channel (RGB and alpha for translucency) is stored with 8 bits of precision (256 possible values.) This configuration is very flexible and offers the best quality. It should be used whenever possible.

RGB_565

Added in API level 1
Bitmap.Config RGB_565

Each pixel is stored on 2 bytes and only the RGB channels are encoded: red is stored with 5 bits of precision (32 possible values), green is stored with 6 bits of precision (64 possible values) and blue is stored with 5 bits of precision. This configuration can produce slight visual artifacts depending on the configuration of the source. For instance, without dithering, the result might show a greenish tint. To get better results dithering should be applied. This configuration may be useful when using opaque bitmaps that do not require high color fidelity.

Public methods

valueOf

Added in API level 1
Bitmap.Config valueOf (String name)

Parameters
name String
Returns
Bitmap.Config

values

Added in API level 1
Config[] values ()

Returns
Config[]
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.