Color Formats

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

Edit on GitHub

Built-in Input Color Formats

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

All of the below format names are used in code by prefixing them with LV_COLOR_FORMAT_ (e.g. LV_COLOR_FORMAT_RGB565).

FormatBPPSupported by offline converterDescription
I1 11YesIndexed with 2-color palette
I2 12YesIndexed with 4-color palette
I4 14YesIndexed with 16-color palette
I8 18YesIndexed with 256-color palette
A88YesPixels express alpha only (used where color is supplied elsewhere as with fonts)
L88YesLuminance: pixels express gray-scale value in range [0-255]
AL8816YesL8 with an alpha byte
RGB56516YesStandard RGB565 (little-endian format)
ARGB856524YesRGB565 preceded by alpha byte
RGB565A824YesRGB565 + trailing alpha byte
RGB565_SWAPPED16YesRGB565 big-endian format
RGB88824YesStandard RGB with 8 bits per color channel
ARGB888832YesStandard ARGB with 8 bits per color channel
XRGB888832YesLike ARGB but alpha bytes are ignored
ARGB8888_PREMULTIPLIED32YesARGB8888 with RGB pre-darkened according to alpha channel value
RAW 2?n/aSee Custom Image Formats
RAW_ALPHA 2?n/aSee Custom Image Formats

Built-In Input and Output Formats

FormatBPPSupported by offline converterDescription
NATIVE 3LV_COLOR_DEPTHNoSee below
NATIVE_WITH_ALPHA 3LV_COLOR_DEPTHNoSee below

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

FormatBPPSupported by offline converterDescription
A11NoLike A8 but only 255 alpha or 0 alpha
A22NoLike A8 but 4 alpha values
A44NoLike A8 but 16 alpha values
ARGB22228NoARGB2222
ARGB155516NoARGB1555
ARGB444416NoARGB4444

YUV Planar Formats

Reference: https://wiki.videolan.org/YUV/

FormatBPPSupported by offline converterDescription
I420NoYUV420 planar (3 plane)
I422NoYUV422 planar (3 plane)
I444NoYUV444 planar (3 plane)
I400NoYUV400 no chroma channel
NV21NoYUV420 planar (2 plane), UV plane in 'V, U, V, U'
NV12NoYUV420 planar (2 plane), UV plane in 'U, V, U, V'

YUV Packed Formats

FormatBPPSupported by offline converterDescription
YUY2NoYUV422 packed like 'Y U Y V'
UYVYNoYUV422 packed like 'U Y V Y'

Proprietary Formats

FormatBPPSupported by offline converterDescription
NEMA_TSC4NoNEMA TSC4
NEMA_TSC6NoNEMA TSC6
NEMA_TSC6ANoNEMA TSC6A
NEMA_TSC6APNoNEMA TSC6AP
NEMA_TSC12NoNEMA TSC12
NEMA_TSC12ANoNEMA TSC12A

Footnotes

  1. I1, I2, I4 and I8 indexed formats require LV_DRAW_SW_SUPPORT_ARGB8888 to be configured to 1 in your lv_conf.h file. Palette colors are always ARGB8888. 2 3 4

  2. Custom formats can be supported by specifying one of the RAW color formats and using an external image decoder to decode it. See Image Decoders. 2

  3. What they mean (from lv_color.h): .. code-block:: #if LV_COLOR_DEPTH == 1 LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_I1, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_I1, #elif LV_COLOR_DEPTH == 8 LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_L8, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_AL88, #elif LV_COLOR_DEPTH == 16 LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_RGB565, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_RGB565A8, #elif LV_COLOR_DEPTH == 24 LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_RGB888, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_ARGB8888, #elif LV_COLOR_DEPTH == 32 LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_XRGB8888, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_ARGB8888, #else #error "LV_COLOR_DEPTH should be 1, 8, 16, 24 or 32" #endif 2

How is this guide?

Last updated on

On this page