# ImageBitmapConfig

Artifact: [androidx.compose.ui:ui-graphics](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/graphics/ImageBitmap.kt+class:androidx.compose.ui.graphics.ImageBitmapConfig) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  value class ImageBitmapConfig
  ```

*** ** * ** ***

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

## Summary

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmapConfig` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmapConfig#Alpha8()` Each pixel is stored as a single translucency (alpha) channel. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmapConfig` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmapConfig#Argb8888()` Each pixel is stored on 4 bytes. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmapConfig` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmapConfig#F16()` Each pixel is stored on 8 bytes. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmapConfig` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmapConfig#Gpu()` Special configuration, when an ImageBitmap is stored only in graphic memory. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmapConfig` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmapConfig#Rgb565()` 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. | Cmn |

| ### Public functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmapConfig#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ImageBitmapConfig#value()` | Cmn |

## Public companion properties

### Alpha8

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Alpha8: ImageBitmapConfig
```

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.

### Argb8888

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Argb8888: ImageBitmapConfig
```

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.

```kotlin
Use this formula to pack into 32 bits:
```

```kotlin
val color =
   ((A and 0xff) shl 24) or
   ((B and 0xff) shl 16) or
   ((G and 0xff) shl 8) or
   (R and 0xff)
```

### F16

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val F16: ImageBitmapConfig
```

Each pixel is stored on 8 bytes. Each channel (RGB and alpha for translucency) is stored as a half-precision floating point value.

This configuration is particularly suited for wide-gamut and HDR content.

```kotlin
Use this formula to pack into 64 bits:
```

```kotlin
    val color =
      ((A and 0xffff) shl 48) or
      ((B and 0xffff) shl 32) or
      ((G and 0xffff) shl 16) or
      (R and 0xffff)
```

### Gpu

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Gpu: ImageBitmapConfig
```

Special configuration, when an ImageBitmap is stored only in graphic memory. ImageBitmaps in this configuration are always immutable.

It is optimal for cases, when the only operation with the ImageBitmap is to draw it on a screen.

### Rgb565

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Rgb565: ImageBitmapConfig
```

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.

```kotlin
Use this formula to pack into 16 bits:
```

```kotlin
val color =
    ((R and 0x1f) shl 11) or
    ((G and 0x3f) shl 5) or
    (B and 0x1f)
```

## Public functions

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### value

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val value: Int
```