PNG to binary conversion memory issue

Hi,
I am trying to convert a PNG images of 4 KB to Binary format using LVGL image converter tool in following patterns :

Color format			Output format		      Output file size
  1. True color Binary RGB565 298 KB
  2. True color with alpha Binary RGB565 446 KB
  3. True color Binary RGB565 Swap 298 KB
  4. True color with alpha Binary RGB565 Swap 446 KB

But binary file size is 74.5 times of png & 111.5 times of png in True color & True color with alpha color formats respectively. I want to understand how binary files are taking this much memory after conversion from png. Is there any technique or tool for reducing the binary file size? Please, help me with the same.

Hi @Amaresh_Ray ,

What you are seeing is correct, the PNG format compresses the pixel data but when it is restored for display on a screen it returns to it’s original size.

Maybe this link might be useful to help explain how PNG works.

Also if you have a file system on your platform you could consider using lodepng library and loading the images at run-time. There is an example in the lvgl documentation here.

Kind Regards,

Pete

Thanks, @pete-pjb for your suggestion. I’ll check with this & update you on the same. Is this lodepng library supporting LVGL v8.0 & v8.1.0?

Hi @Amaresh_Ray ,

Yes see here.

Kind Regards,

Pete

Hi @pete-pjb,

Thanks for the information. Our system use 390x390 pixel display and below memory configuration

RAM - 768KB
PSRAM - 8MB
External Memory - 16MB
Internal flash - 2MB.

In RAM, we have allocated ~300 KB for 1 Frame Buffer.
Internal flash is for code and OTA.
we understand from document it requires (4ximage widthximage height) bytes of RAM. That means about ~600KB RAM.
Can we use PSRAM to decode the PNG ? if yes is there any lag in the system when populating the PNG?

Thanks,

Hi @Amaresh_Ray ,

I assume you are using some form of ESP32 MCU?

I am not familiar with these devices, but my guess is you will see a considerable drop in throughput if you use the PSRAM, from the little I know about it, it is just a 4-bit interface which is clocked at 80MHz which will almost certainly be an order of magnitude slower than the 32-bit internal RAM of your device which is most likely clocked at the MCU clock rate.

This is all speculation on my part so if I’m wrong I apologise :slight_smile:

Cheers,

Pete