You can use this base64 sample decoder and encoder to:
Old version for v5.1.1
Color format details
True color, True color with alpha, True color chroma key
If the Output format is C array then the following pixel formats will be included in the array: RGB888, RGB565, BGR565 (bytes swapped) and RGB332.
The corresponding format will be enabled according to LV_COLOR_DEPTH and LV_COLOR_16_SWAP settings in lv_conf.h.
If Dithering is appiled the pixels will be slightly modified on non RGB888 formats to prevent color banding.
If you need a Binary output then you need to select the pixel format you need. Dithering can be applied here as well
If True color with alpha is chosen then an extra alpha byte will be added to every pixel resulting in pixels formats like: ARGB8888, ARGB8565, ARGB8332.
PNG format is recommended with 32 bit (ARGB8888) colors.
True color chroma key will result the same file as True color except it will be marked as Chroma keyed which means the LV_COLOR_TRANSP (lv_conf.h) pixles will be rendered as transparent.
JPG should be avoided because it doesn't keep the colors as they are. There for LV_COLOR_TRANSP pixels can change.
Indexed 2/4/16/256 colors
A palette will be generated at beginning of the result array with 2/4/16/256 colors and pixels will be coded on 1/2/4/8 bits. For the best quality, the uploaded image already should be in index format too.
You can use GIMP to do the conversion in Image->Mode->Indexed menu. Here you can set the number of colors and enabled dithering as well.
In LittlevGL these images will be always Chroma keyed.
Alpha only 2/4/16/256 shades
Only the alpha channel is taken into account and stored in 1/2/4/8 bits to result 2/4/16/256 shades. Pixels with alpha = 0 will be transparent. The other pixel's color will style.image.color and their alpha will be set according to the original'pixels alpha.
The image has to contain alpha channel. E.g.
How to Convert String to Bytes Array in C#
Raw, Raw with alpha, Raw chroma key
The image is not interpreted pixel-by-pixel just converted to an array as it is. It is useful for example to convert a PNG file to a C array to store the PNG image in flash and use LittlevGL's Image decoder interface