Render image from buffer

Description

Need help to render an image from buffer.

What MCU/Processor/Board and compiler are you using?

Linux dev env

What LVGL version are you using?

v9

What do you want to achieve?

I have the raw bytes of the image that I request using curl and I want to render on the screen but for some reason doesn’t work.

Code to reproduce

Right now, the code looks something like this:

  lv_img_dsc_t img_dsc;
  img_dsc.header.w = 256;
  img_dsc.header.h = 256;
  img_dsc.header.cf = LV_COLOR_FORMAT_RGB888; // also tried other flags
  img_dsc.data = imageBuffer;
  img_dsc.data_size = imageBuffeSize;

  lv_obj_t *img= lv_img_create(lv_obj);
  lv_img_set_src(img, &img_dsc);

Sometimes I get random garbage (letters and symbols) on the screen.
I don’t know if i need to change to the color format or I need to extende the libpng driver functionality? or somehting… Any help is appreciated!

Curious - did you get this to work? I’m having trouble displaying my image from buffer too. Works when I display from a file stored in SPIFFs.