Render image from url

Description

Need help to display an image from url.

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.

What have you tried so far?

A lot of things that I can even remember :sweat_smile:

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;
  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!

If possible, can you share the data url for testing?
The code below works on esp32

lv_img_dsc_t img_dsc;

img_dsc.header.cf = LV_COLOR_FORMAT_RGB565;
img_dsc.header.magic = LV_IMAGE_HEADER_MAGIC;
img_dsc.header.w = 100;
img_dsc.header.h = 100;
img_dsc.data_size = 100 * 100 * 2;
img_dsc.data = (uint8_t *)malloc(100 * 100 * 2);

// fetch data from url to allocated memory
// http://iot.fbiego.com/lvgl/lvgl-100.bin