I want to display a JPG on my TFT, because BMP’s are to big for the microcontroller flash.
BMP is working fine with LVGL.
But if i try to display a JPG, nothing or waste will be displayed.
I convert the JPG to a sJPG, converted with the jpg_to_sjpg.py
The Online-Converter can’t convert the JPG to sJPG, because Color format = RAW isn’t present ( like explaned in the actual docu from TinyJepg: Tiny JPEG Decompressor (TJpgDec) - LVGL 9.4 documentation). He creates only a big BMP-format.
The original JPG is 8KB, the converted sJPG is 10KB (small image for testing)
I have try it with LVGL V8.3.0 and LVGL V9.3.0.
In lv_conf.h, i activate:
#define LV_USE_TJPGD 1
#define LV_USE_SJPG 1
Activation of LV_USE_LIBJPEG_TURBO is not possible, because important functions of the encoder are missing in the lvgl repro.
Code:
lv_tjpgd_init();
LV_IMAGE_DECLARE(Brot_S); // Hintergrund-Bild Brot
lv_obj_t * img1 = lv_image_create(lv_screen_active());
lv_image_set_src(img1, &Brot_S);
lv_obj_align(img1, LV_ALIGN_CENTER, 0, 0);
I tryed in the header.cf from lv_image_dsc_t of the small image:
- LV_COLOR_FORMAT_RGB565 → waste
- LV_COLOR_FORMAT_RAW → nothing
- LV_COLOR_FORMAT_RGB888 → waste
- LV_COLOR_FORMAT_RGB565A8 → nothing
- LV_IMG_CF_RAW → unknown
lv_image_dsc_t Brot_S = {
//.header.always_zero = 0,
.header.cf = LV_COLOR_FORMAT_RGB565A8, // LV_COLOR_FORMAT_RGB565,
.header.magic = LV_IMAGE_HEADER_MAGIC,
.header.w = 128,
.header.h = 93,
.data_size = 9550,
// .header.cf = LV_COLOR_FORMAT_RAW, // LV_IMG_CF_RAW,
.data = Brot_S_map,
};
So my question:
Is it really possible to display a JPG-Image, or is it only planned in the future ??
How can i display a sJPG-Image (or JPG-Image) with LVGL ?
Environment
-
MCU/MPU/Board: Using a STM32H7B3I-DK @ STM32CubeIDE
-
LVGL version: 8.3 and 9.3

