Load image from lv_img_dsc_t


I want to draw bmp file.

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

ESP32 Wrover

What LVGL version are you using?


What do you want to achieve?

Load image from bmp file.

What have you tried so far?

I tried lv_lib_bmp and lv_lib_png but doesnt work.

Code to reproduce

The code block(s) should be formatted like:
Read bitmaps from BMP file after header read.

         for(int k = 0; k < Header.biWidth * Header.biHeight*4 * sizeof(uint8_t); k++){
        	fread(&img_datas[k], sizeof(img_datas[k]), 1, BMPFile);

Draw img:

        static lv_img_dsc_t my_img_dsc = {
            .header.always_zero = 0,
        	.header.reserved = 0,
            .header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA,
        my_img_dsc.header.w = Header.biWidth;
    	my_img_dsc.header.h = Header.biHeight;
    	my_img_dsc.data_size = Header.biWidth *Header.biHeight * LV_IMG_PX_SIZE_ALPHA_BYTE;
    	my_img_dsc.data = img_datas;

        lv_obj_t * icon = lv_img_create(lv_scr_act(), NULL);
        lv_img_set_src(icon, &my_img_dsc);

Screenshot and/or video

The bitmaps is good. I get strange screen after this code.