No image: sjpeg decoder

Description

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

Linux, gcc / g++ (mixed, LVLG is compiled with gcc, the main application with g++ and they’re linked with g++)

What LVGL version are you using?

Master. I’m using (a modified version of) the simulator, pulling the master branches for lvgl and lv_drivers and with an updated Makefile to allow for c++ compilation as I’m using libCURL.

What do you want to achieve?

Display an image from the filesystem

What have you tried so far?

In lv_conf.h, I have enabled the STDIO driver and given the letter “S”

#define LV_USE_FS_STDIO 1
#if LV_USE_FS_STDIO
    #define LV_FS_STDIO_LETTER 'S'     /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
    #define LV_FS_STDIO_PATH ""         /*Set the working directory. File/directory paths will be appended to it.*/
    #define LV_FS_STDIO_CACHE_SIZE 0    /*>0 to cache this number of bytes in lv_fs_read()*/
#endif

I’ve tried using the STDIO and POSIX drivers both with the same effect.

Code to reproduce

After lv_init() I’ve created an image object and set the source with an absolute path:

lv_obj_t * image = lv_img_create(lv_scr_act());
lv_img_set_src(image, "S:/home/phill/Downloads/amigo.jpg");
lv_obj_align(image, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_size(image, 200, 200);

Logs

I’ve enabled logging, and nothing is printed that shows an error, only the creation of the lv_img object.

[Info]  (0.000, +0)      lv_init: begin         (in lv_obj.c line #102)
[Info]  (0.000, +0)      lv_obj_create: begin   (in lv_obj.c line #206)
[Info]  (0.000, +0)      lv_obj_create: begin   (in lv_obj.c line #206)
[Info]  (0.000, +0)      lv_obj_create: begin   (in lv_obj.c line #206)
[Info]  (0.000, +0)      lv_img_create: begin   (in lv_img.c line #60)
[Info]  (0.000, +0)      lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #314)
[Info]  (0.000, +0)      lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #314)
[Info]  (0.000, +0)      lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #314)
[Info]  (0.000, +0)      lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #314)

Any help appreciated!

1 Like

i have same problem also. im using esp32S3 display (waveshare 7 inch display).
how to show image from sd card ? any steps need to follow?

i use example but its not give output.
lvgl documentation

my code below:

void lv_example_png_1(void) {  // Create a new screen for the loading phase
  lv_obj_t *IDScreen = lv_obj_create(NULL);
  lv_obj_set_style_bg_color(IDScreen, lv_color_hex(0xF5F5F5), LV_PART_MAIN);
  lv_obj_set_style_bg_opa(IDScreen, LV_OPA_COVER, LV_PART_MAIN);

  lv_obj_t *img_ID = lv_img_create(IDScreen);
  lv_img_set_src(img_ID, &"S:img/ID3.jpg");
  lv_obj_align(img_ID, LV_ALIGN_CENTER, 0, 0);

  // Set the screen as the active screen
  lv_scr_load(IDScreen);
}