Description
What MCU/Processor/Board and compiler are you using?
codeblocks simulator
What LVGL version are you using?
LVGL 7.7.2
What do you want to achieve?
use custom image with https://lvgl.io/tools/imageconverter
What have you tried so far?
I displayed successfully the image in lv_ex_img_1() found in lv_examples\lv_ex_widgets\lv_ex_img_1.c ( it uses img_cogwheel_argb.c )
I did not manage to get https://lvgl.io/tools/imageconverter to work on 2 different images. The code only outputs several strange letters in my larger image files, or nothing. I tried the “indexed 16 colors” , “true color” and “true color with alpha” options in the imageconverter. What is wrong? Does LVGL 7.7.2 support a different option than the ones I chose? Is there an return value I can check for error ?
Code to reproduce
The code block(s) should be formatted like:
void load_img_smiley_map(void)
{
LV_IMG_DECLARE(smile_map);
lv_obj_t * img1 = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(img1, &smile_map);
lv_obj_align(img1, NULL, LV_ALIGN_CENTER, 0, -20);
lv_obj_t * img2 = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(img2, LV_SYMBOL_OK "Accept");
lv_obj_align(img2, img1, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
}
smile.c:
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif
#ifndef LV_ATTRIBUTE_IMG_SMILE
#define LV_ATTRIBUTE_IMG_SMILE
#endif
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_SMILE uint8_t smile_map[] = {
0x22, 0x25, 0x26, 0xff, /*Color of index 0*/
0x37, 0xe3, 0xea, 0xff, /*Color of index 1*/
0x36, 0xda, 0xe1, 0xff, /*Color of index 2*/
0x34, 0xcb, 0xd1, 0xff, /*Color of index 3*/
0x33, 0xc1, 0xc7, 0xff, /*Color of index 4*/
0x31, 0xb0, 0xb5, 0xff, /*Color of index 5*/
0x2f, 0xa1, 0xa6, 0xff, /*Color of index 6*/
0x2d, 0x85, 0x89, 0xff, /*Color of index 7*/
0x2a, 0x6c, 0x70, 0xff, /*Color of index 8*/
0x28, 0x55, 0x58, 0xff, /*Color of index 9*/
0xff, 0xf7, 0xf7, 0xff, /*Color of index 10*/
0xff, 0xe3, 0xe3, 0xff, /*Color of index 11*/
0xed, 0xc7, 0xc7, 0xff, /*Color of index 12*/
0xd2, 0xac, 0xac, 0xff, /*Color of index 13*/
0xbc, 0x96, 0x96, 0xff, /*Color of index 14*/
0x1e, 0x01, 0x01, 0xff, /*Color of index 15*/
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xbd, 0xee, 0x66, 0x66, 0xee, 0xdb, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xab, 0xd6, 0x42, 0x11, 0x11, 0x11, 0x11, 0x14, 0x6d, 0xba, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa, 0xab, 0xd5, 0x21, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x5d, 0xba, 0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa, 0xc6, 0x21, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x6c, 0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xad, 0x41, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x14, 0xda, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xe2, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x2e, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xae, 0x21, 0x11, 0x11, 0x11, 0x54, 0x11, 0x11, 0x11, 0x11, 0x26, 0x21, 0x11, 0x11, 0x12, 0xea, 0xaa, 0xaa,
0xaa, 0xaa, 0xd2, 0x11, 0x11, 0x11, 0x15, 0xf0, 0x21, 0x11, 0x11, 0x11, 0x7f, 0x81, 0x11, 0x11, 0x11, 0x2d, 0xaa, 0xaa,
0xaa, 0xac, 0x41, 0x11, 0x11, 0x11, 0x18, 0xff, 0x61, 0x11, 0x11, 0x11, 0xff, 0xf3, 0x11, 0x11, 0x11, 0x14, 0xca, 0xaa,
0xaa, 0xb6, 0x11, 0x11, 0x11, 0x11, 0x1f, 0xff, 0x81, 0x11, 0x11, 0x14, 0xff, 0xf6, 0x11, 0x11, 0x11, 0x11, 0x6b, 0xaa,
0xaa, 0xd2, 0x11, 0x11, 0x11, 0x11, 0x3f, 0xff, 0x91, 0x11, 0x11, 0x16, 0xff, 0xf7, 0x11, 0x11, 0x11, 0x11, 0x2d, 0xaa,
0xab, 0x51, 0x11, 0x11, 0x11, 0x11, 0x4f, 0xff, 0x02, 0x11, 0x11, 0x16, 0xff, 0xf7, 0x11, 0x11, 0x11, 0x11, 0x15, 0xba,
0xad, 0x21, 0x11, 0x11, 0x11, 0x11, 0x4f, 0xff, 0xf1, 0x11, 0x11, 0x16, 0xff, 0xf7, 0x11, 0x11, 0x11, 0x11, 0x12, 0xda,
0xa6, 0x11, 0x11, 0x11, 0x11, 0x11, 0x3f, 0xff, 0x01, 0x11, 0x11, 0x16, 0xff, 0xf7, 0x11, 0x11, 0x11, 0x11, 0x11, 0x6a,
0xb4, 0x11, 0x11, 0x11, 0x11, 0x11, 0x2f, 0xff, 0x91, 0x11, 0x11, 0x15, 0xff, 0xf6, 0x11, 0x11, 0x11, 0x11, 0x11, 0x4b,
0xd2, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0xff, 0x71, 0x11, 0x11, 0x13, 0xff, 0xf5, 0x11, 0x11, 0x11, 0x11, 0x11, 0x2d,
0xe1, 0x11, 0x11, 0x11, 0x11, 0x11, 0x17, 0xff, 0x51, 0x11, 0x11, 0x12, 0x9f, 0xf2, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1e,
0xe1, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x08, 0x11, 0x11, 0x11, 0x11, 0x5f, 0x61, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1e,
0x61, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x21, 0x11, 0x11, 0x11, 0x11, 0x12, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x16,
0x61, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x16,
0x61, 0x11, 0x26, 0x76, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x73, 0x11, 0x16,
0x61, 0x11, 0x68, 0x05, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x40, 0x75, 0x11, 0x16,
0xe1, 0x11, 0x13, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x31, 0x11, 0x1e,
0xe1, 0x11, 0x12, 0xf2, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x3f, 0x21, 0x11, 0x1e,
0xd2, 0x11, 0x11, 0x85, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x58, 0x11, 0x11, 0x1d,
0xb4, 0x11, 0x11, 0x58, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x95, 0x11, 0x11, 0x4b,
0xa6, 0x11, 0x11, 0x20, 0x41, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x14, 0x02, 0x11, 0x11, 0x6a,
0xad, 0x21, 0x11, 0x15, 0x92, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x29, 0x61, 0x11, 0x12, 0xda,
0xab, 0x51, 0x11, 0x11, 0x87, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x78, 0x11, 0x11, 0x15, 0xba,
0xaa, 0xd2, 0x11, 0x11, 0x29, 0x71, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x17, 0x93, 0x11, 0x11, 0x2d, 0xaa,
0xaa, 0xb6, 0x11, 0x11, 0x12, 0x98, 0x21, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x89, 0x21, 0x11, 0x11, 0x6b, 0xaa,
0xaa, 0xac, 0x41, 0x11, 0x11, 0x27, 0x06, 0x21, 0x11, 0x11, 0x11, 0x11, 0x12, 0x60, 0x71, 0x11, 0x11, 0x14, 0xca, 0xaa,
0xaa, 0xaa, 0xd2, 0x11, 0x11, 0x11, 0x48, 0x07, 0x43, 0x11, 0x12, 0x25, 0x70, 0x84, 0x11, 0x11, 0x11, 0x2d, 0xaa, 0xaa,
0xaa, 0xaa, 0xae, 0x21, 0x11, 0x11, 0x11, 0x46, 0x9f, 0xf0, 0x0f, 0xf8, 0x73, 0x11, 0x11, 0x11, 0x12, 0xea, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xe2, 0x11, 0x11, 0x11, 0x11, 0x11, 0x33, 0x42, 0x21, 0x11, 0x11, 0x11, 0x11, 0x2e, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xad, 0x41, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x14, 0xda, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa, 0xc6, 0x21, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x6c, 0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa, 0xab, 0xd5, 0x21, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x5d, 0xba, 0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xab, 0xde, 0x42, 0x11, 0x11, 0x11, 0x11, 0x24, 0x6d, 0xba, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xbd, 0xee, 0x66, 0x66, 0xee, 0xdb, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
};
const lv_img_dsc_t smile = {
.header.cf = LV_IMG_CF_INDEXED_4BIT,
.header.always_zero = 0,
.header.reserved = 0,
.header.w = 40,
.header.h = 40,
.data_size = 865,
.data = smile_map,
};
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.