# Color Formats (/main-modules/images/color_formats)



Built-in Input Color Formats [#built-in-input-color-formats]

The following image pixel color formats have built-in decoding support:

<Callout type="info">
  All of the below format names are used in code by prefixing them with
  `LV_COLOR_FORMAT_` (e.g. <ApiLink name="LV_COLOR_FORMAT_RGB565" />).
</Callout>

| Format                  | BPP | Supported by offline converter | Description                                                                      |
| ----------------------- | --- | ------------------------------ | -------------------------------------------------------------------------------- |
| I1 [^1]                 | 1   | Yes                            | Indexed with 2-color palette                                                     |
| I2 [^1]                 | 2   | Yes                            | Indexed with 4-color palette                                                     |
| I4 [^1]                 | 4   | Yes                            | Indexed with 16-color palette                                                    |
| I8 [^1]                 | 8   | Yes                            | Indexed with 256-color palette                                                   |
| A8                      | 8   | Yes                            | Pixels express alpha only (used where color is supplied elsewhere as with fonts) |
| L8                      | 8   | Yes                            | Luminance: pixels express gray-scale value in range \[0-255]                     |
| AL88                    | 16  | Yes                            | L8 with an alpha byte                                                            |
| RGB565                  | 16  | Yes                            | Standard RGB565 (little-endian format)                                           |
| ARGB8565                | 24  | Yes                            | RGB565 preceded by alpha byte                                                    |
| RGB565A8                | 24  | Yes                            | RGB565 + trailing alpha byte                                                     |
| RGB565\_SWAPPED         | 16  | Yes                            | RGB565 big-endian format                                                         |
| RGB888                  | 24  | Yes                            | Standard RGB with 8 bits per color channel                                       |
| ARGB8888                | 32  | Yes                            | Standard ARGB with 8 bits per color channel                                      |
| XRGB8888                | 32  | Yes                            | Like ARGB but alpha bytes are ignored                                            |
| ARGB8888\_PREMULTIPLIED | 32  | Yes                            | ARGB8888 with RGB pre-darkened according to alpha channel value                  |
| RAW [^2]                | ?   | n/a                            | See [Custom Image Formats](/main-modules/images/decoders)                        |
| RAW\_ALPHA [^2]         | ?   | n/a                            | See [Custom Image Formats](/main-modules/images/decoders)                        |

[^1]: I1, I2, I4 and I8 indexed formats require <ApiLink name="LV_DRAW_SW_SUPPORT_ARGB8888" /> to be configured to `1` in your `lv_conf.h` file.  Palette colors are always `ARGB8888`.

[^2]: Custom formats can be supported by specifying one of the RAW color formats and using an external [image decoder](/main-modules/images/decoders) to decode it. See [Image Decoders](/main-modules/images/decoders).

Built-In Input and Output Formats [#built-in-input-and-output-formats]

| Format                   | BPP     | Supported by offline converter | Description                                                                                   |
| ------------------------ | ------- | ------------------------------ | --------------------------------------------------------------------------------------------- |
| NATIVE [^3]              | Depends | No                             | Alias of <ApiLink name="LV_COLOR_FORMAT_DEFAULT" />, the format displays render in by default |
| NATIVE\_WITH\_ALPHA [^3] | Depends | No                             | The alpha-capable companion of <ApiLink name="LV_COLOR_FORMAT_DEFAULT" />                     |

[^3]: Both were `lv_color_format_t` enumerators picked by `LV_COLOR_DEPTH`. They are no
    longer part of the enum and live on as compatibility macros in
    `lv_api_map_v9_5.h`, so they keep working unless you build with
    `LV_DISABLE_API_MAPPING`:

    | `LV_COLOR_FORMAT_DEFAULT` | `..._NATIVE`             | `..._NATIVE_WITH_ALPHA`              |
    | ------------------------- | ------------------------ | ------------------------------------ |
    | `I1`                      | `I1`                     | `I1` (no alpha-capable 1-bit format) |
    | `L8`                      | `L8`                     | `AL88`                               |
    | `RGB565`                  | `RGB565`                 | `RGB565A8`                           |
    | `RGB565_SWAPPED`          | `RGB565_SWAPPED`         | `RGB565A8`                           |
    | `RGB888`                  | `RGB888`                 | `ARGB8888`                           |
    | `XRGB8888`                | `XRGB8888`               | `ARGB8888`                           |
    | `ARGB8888`                | `ARGB8888`               | `ARGB8888`                           |
    | `ARGB8888_PREMULTIPLIED`  | `ARGB8888_PREMULTIPLIED` | `ARGB8888_PREMULTIPLIED`             |

    In new code, name the format you want directly, or read a display's actual format
    with <ApiLink name="lv_display_get_color_format" />, which is what you want if the
    format was changed at runtime with <ApiLink name="lv_display_set_color_format" />.
    See [Color Format](/main-modules/display/color_format).

GPU Input Formats [#gpu-input-formats]

The following color formats are supported by certain GPUs and are retained as
color-format enumeration values that can be used when a GPU is going to be doing the
drawing.

Alpha-Only and Special ARGB Formats [#alpha-only-and-special-argb-formats]

| Format   | BPP | Supported by offline converter | Description                           |
| -------- | --- | ------------------------------ | ------------------------------------- |
| A1       | 1   | No                             | Like A8 but only 255 alpha or 0 alpha |
| A2       | 2   | No                             | Like A8 but 4 alpha values            |
| A4       | 4   | No                             | Like A8 but 16 alpha values           |
| ARGB2222 | 8   | No                             | ARGB2222                              |
| ARGB1555 | 16  | No                             | ARGB1555                              |
| ARGB4444 | 16  | No                             | ARGB4444                              |

YUV Planar Formats [#yuv-planar-formats]

Reference: [https://wiki.videolan.org/YUV/](https://wiki.videolan.org/YUV/)

| Format | BPP | Supported by offline converter | Description                                       |
| ------ | --- | ------------------------------ | ------------------------------------------------- |
| I420   |     | No                             | YUV420 planar (3 plane)                           |
| I422   |     | No                             | YUV422 planar (3 plane)                           |
| I444   |     | No                             | YUV444 planar (3 plane)                           |
| I400   |     | No                             | YUV400 no chroma channel                          |
| NV21   |     | No                             | YUV420 planar (2 plane), UV plane in 'V, U, V, U' |
| NV12   |     | No                             | YUV420 planar (2 plane), UV plane in 'U, V, U, V' |

YUV Packed Formats [#yuv-packed-formats]

| Format | BPP | Supported by offline converter | Description                  |
| ------ | --- | ------------------------------ | ---------------------------- |
| YUY2   |     | No                             | YUV422 packed like 'Y U Y V' |
| UYVY   |     | No                             | YUV422 packed like 'U Y V Y' |

Proprietary Formats [#proprietary-formats]

| Format       | BPP | Supported by offline converter | Description |
| ------------ | --- | ------------------------------ | ----------- |
| NEMA\_TSC4   |     | No                             | NEMA TSC4   |
| NEMA\_TSC6   |     | No                             | NEMA TSC6   |
| NEMA\_TSC6A  |     | No                             | NEMA TSC6A  |
| NEMA\_TSC6AP |     | No                             | NEMA TSC6AP |
| NEMA\_TSC12  |     | No                             | NEMA TSC12  |
| NEMA\_TSC12A |     | No                             | NEMA TSC12A |
