Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Enums](https://developer.android.com/reference/android/graphics/Bitmap.Config#enumconstants) \| [Methods](https://developer.android.com/reference/android/graphics/Bitmap.Config#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/graphics/Bitmap.Config#inhmethods)

# Bitmap.Config

*** ** * ** ***

` public static final enum Bitmap.Config `   
` ` ` extends https://developer.android.com/reference/java/lang/Enum<https://developer.android.com/reference/android/graphics/Bitmap.Config> ` ` `

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [java.lang.Enum](https://developer.android.com/reference/java/lang/Enum)\<[android.graphics.Bitmap.Config](https://developer.android.com/reference/android/graphics/Bitmap.Config)\> ||
|   | ↳ | android.graphics.Bitmap.Config |

<br />

*** ** * ** ***

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 ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Bitmap.Config` | `ALPHA_8` Each pixel is stored as a single translucency (alpha) channel. |
| `https://developer.android.com/reference/android/graphics/Bitmap.Config` | `ARGB_4444` *This field was deprecated in API level 29. Because of the poor quality of this configuration, it is advised to use `https://developer.android.com/reference/android/graphics/Bitmap.Config#ARGB_8888` instead.* |
| `https://developer.android.com/reference/android/graphics/Bitmap.Config` | `ARGB_8888` Each pixel is stored on 4 bytes. |
| `https://developer.android.com/reference/android/graphics/Bitmap.Config` | `HARDWARE` Special configuration, when bitmap is stored only in graphic memory. |
| `https://developer.android.com/reference/android/graphics/Bitmap.Config` | `RGBA_1010102` Each pixel is stored on 4 bytes. |
| `https://developer.android.com/reference/android/graphics/Bitmap.Config` | `RGBA_F16` Each pixel is stored on 8 bytes. |
| `https://developer.android.com/reference/android/graphics/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 https://developer.android.com/reference/android/graphics/Bitmap.Config` | ` https://developer.android.com/reference/android/graphics/Bitmap.Config#valueOf(java.lang.String)(https://developer.android.com/reference/java/lang/String name) ` |
| ` static final https://developer.android.com/reference/android/graphics/Bitmap.Config` | ` https://developer.android.com/reference/android/graphics/Bitmap.Config#values()() ` |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Enum ` ` final https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Enum#clone()() `

Throws CloneNotSupportedException.
` final int` ` https://developer.android.com/reference/java/lang/Enum#compareTo(E)(https://developer.android.com/reference/android/graphics/Bitmap.Config o) `

Compares this enum with the specified object for order.
` final boolean` ` https://developer.android.com/reference/java/lang/Enum#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object other) `

Returns true if the specified object is equal to this enum constant.
` final void` ` https://developer.android.com/reference/java/lang/Enum#finalize()() `

enum classes cannot have finalize methods.
` final https://developer.android.com/reference/java/lang/Class<https://developer.android.com/reference/android/graphics/Bitmap.Config>` ` https://developer.android.com/reference/java/lang/Enum#getDeclaringClass()() `

Returns the Class object corresponding to this enum constant's enum type.
` final int` ` https://developer.android.com/reference/java/lang/Enum#hashCode()() `

Returns a hash code for this enum constant.
` final https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Enum#name()() `

Returns the name of this enum constant, exactly as declared in its enum declaration.
` final int` ` https://developer.android.com/reference/java/lang/Enum#ordinal()() `

Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Enum#toString()() `

Returns the name of this enum constant, as contained in the declaration.
` static <T extends https://developer.android.com/reference/java/lang/Enum<T>> T` ` https://developer.android.com/reference/java/lang/Enum#valueOf(java.lang.Class<T>,%20java.lang.String)(https://developer.android.com/reference/java/lang/Class<T> enumClass, https://developer.android.com/reference/java/lang/String name) `

Returns the enum constant of the specified enum class with the specified name.
From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/java/lang/Comparable ` ` abstract int` ` https://developer.android.com/reference/java/lang/Comparable#compareTo(T)(https://developer.android.com/reference/android/graphics/Bitmap.Config o) `

Compares this object with the specified object for order.

## Enum values

### ALPHA_8

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final 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.

<br />

### ARGB_4444

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Bitmap.Config ARGB_4444
```

<br />

**This field was deprecated in API level 29.**   

Because of the poor quality of this configuration, it is advised to use `https://developer.android.com/reference/android/graphics/Bitmap.Config#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 `https://developer.android.com/reference/android/graphics/Bitmap.Config#ARGB_8888` instead of this configuration. Note: as of `https://developer.android.com/reference/android/os/Build.VERSION_CODES#KITKAT`, any bitmap created with this configuration will be created using `https://developer.android.com/reference/android/graphics/Bitmap.Config#ARGB_8888` instead.

<br />

### ARGB_8888

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final 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.

When accessing directly via `https://developer.android.com/reference/android/graphics/Bitmap#copyPixelsFromBuffer(java.nio.Buffer)` or `https://developer.android.com/reference/android/graphics/Bitmap#copyPixelsToBuffer(java.nio.Buffer)`, use this formula to pack into 32 bits:

```
int color = (A & 0xff) << 24 | (B & 0xff) << 16 | (G & 0xff) << 8 | (R & 0xff);
```

<br />

<br />

### HARDWARE

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Bitmap.Config HARDWARE
```

Special configuration, when bitmap is stored only in graphic memory. Bitmaps in this configuration are always immutable. It is optimal for cases, when the only operation with the bitmap is to draw it on a screen.

<br />

### RGBA_1010102

Added in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Bitmap.Config RGBA_1010102
```

Each pixel is stored on 4 bytes. Each RGB channel is stored with 10 bits of precision (1024 possible values). There is an additional alpha channel that is stored with 2 bits of precision (4 possible values). This configuration is suited for wide-gamut and HDR content which does not require alpha blending, such that the memory cost is the same as ARGB_8888 while enabling higher color precision.

When accessing directly via `https://developer.android.com/reference/android/graphics/Bitmap#copyPixelsFromBuffer(java.nio.Buffer)` or `https://developer.android.com/reference/android/graphics/Bitmap#copyPixelsToBuffer(java.nio.Buffer)`, use this formula to pack into 32 bits:

```
int color = (A & 0x3) << 30 | (B & 0x3ff) << 20 | (G & 0x3ff) << 10 | (R & 0x3ff);
```

<br />

<br />

### RGBA_F16

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Bitmap.Config RGBA_F16
```

Each pixel is stored on 8 bytes. Each channel (RGB and alpha for translucency) is stored as a `https://developer.android.com/reference/android/util/Half`. This configuration is particularly suited for wide-gamut and HDR content.

When accessing directly via `https://developer.android.com/reference/android/graphics/Bitmap#copyPixelsFromBuffer(java.nio.Buffer)` or `https://developer.android.com/reference/android/graphics/Bitmap#copyPixelsToBuffer(java.nio.Buffer)`, use this formula to pack into 64 bits:

```
long color = (A & 0xffff) << 48 | (B & 0xffff) << 32 | (G & 0xffff) << 16 | (R & 0xffff);
```

<br />

<br />

### RGB_565

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final 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.

When accessing directly via `https://developer.android.com/reference/android/graphics/Bitmap#copyPixelsFromBuffer(java.nio.Buffer)` or `https://developer.android.com/reference/android/graphics/Bitmap#copyPixelsToBuffer(java.nio.Buffer)`, use this formula to pack into 16 bits:

```
short color = (R & 0x1f) << 11 | (G & 0x3f) << 5 | (B & 0x1f);
```

<br />

<br />

## Public methods

### valueOf

```
public static Bitmap.Config valueOf (String name)
```

<br />

<br />

| Parameters ||
|---|---|
| `name` | `String` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Bitmap.Config` | <br /> |

### values

```
public static final Config[] values ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Bitmap.Config` | <br /> |