I recently started my first project using LVGL and its been quite good to use so far.
The GUI we have to build is quite simple, but we are also pretty limited in storage (256KB flash).
There’s several icons we need to include in our GUI and these have been delivered to us by our customer.
To save on storage size and since the icons are quite simple anyways, we have decided to format the PNGs as C array with Indexed 2 color format, using the LVGL image converter tool.
This makes it so that the icons essentially can have 2 colors, 1 foreground, 1 background. Black is chromakey will not be shown on our display (transparent).
The transparency works just fine and I can display the images on our display, however the quality is very poor.
This is the icon that has been delivered to us.
When I upload the icon to a PNG analyzer, you can see the effect that I now encounter. After converted, the icon looks like the top picture under “RGB channels without Alpha” as you can see below, while I expect it to look like the bottom one under “Alpha channel” with the color of the top.
I’m not sure where this loss in quality comes from and how the alpha channel has influence in this. I’m quite unexperienced when it comes to images and their formatting, so perhaps there is something easy I’m not seeing, but any help is much appreciated!
What MCU/Processor/Board and compiler are you using?
Renesas R7FA2L1AB with a ILI9341 display
Using the GCC 22.214.171.12400408 toolchain
What LVGL version are you using?
What do you want to achieve?
I want to find out why the quality of the icon decreases so drastically after conversion to C array, as seen in above pictures.
What have you tried so far?
We tried several different ways of exporting the PNGs but to seemingly no avail, we had issues with transparency before, that seems fixed but now we have run into this.
Increasing the color format in the conversion process to “4 indexed colors” or “Alpha only 2 shades” seems to increase the quality quite significantly, but I don’t really understand how, as the icons are so limited in color.
Code to reproduce