Advice please! Images created from converted .c files not displaying on Arduino IDE (2.3.4) [Giga R1] [Giga Display]

Hello all!

I’ve had an Arduino Giga Display project on the backburner for a few months and was trying to get back into it now. I’ve updated to v9.2 since the Giga display is now compatible and have very basic code working that generates a screen called mainMenu with a title bar and title text at the top. I’m trying to add in a basic test image and have been stuck for the past day. I have a 133x133 RGB png of a frog which I converted to a RGB565 .c file using the LVGL image converter. I put the file my Arduino project folder next to the .ino file and modified the code to remove the “.header” designations as those make the files fail at compile time:

const lv_image_dsc_t frog = {
  {
    LV_COLOR_FORMAT_RGB565,
    LV_IMAGE_HEADER_MAGIC,
    //0,
    //2,
    133,
    133},
  17689 * 2,
  frog_map
};
**Again, without changing the code in ``const lv_image_dsc_t`` I get a compile fail due to an unexpected "." before the ".h" and ".w" etc.

I declare and add the image to my active screen:

  LV_IMAGE_DECLARE(frog);
  lv_obj_t * imgTest = lv_image_create(lv_screen_active());
  lv_image_set_src(imgTest, &frog);
  lv_obj_align(imgTest, LV_ALIGN_CENTER, 0, 0);

The code compiles fine, and the mainMenu screen and title bar/text load but no image is visible. I’m not sure where to go from here in terms of troubleshooting. Everything else I’ve tried fails to compile altogether. This at least compiles and forms my screen with the other elements and is just not loading the image element for some reason.

Any help is appreciated! Thanks! (Full code below)

#include "Arduino_H7_Video.h"
#include <lvgl.h>
#include "frog.c"

#include "Arduino_GigaDisplayTouch.h"
#include "Arduino_GigaDisplay.h"


Arduino_H7_Video          Display(800, 480, GigaDisplayShield); /* Arduino_H7_Video Display(1024, 768, USBCVideo); */
Arduino_GigaDisplayTouch  TouchDetector;
GigaDisplayBacklight backlight;

lv_obj_t * mainMenu;
lv_obj_t * Title_bar;
lv_obj_t * Title_txt;




void setup() {
  Display.begin();
  TouchDetector.begin();
  Main_Menu_Init();
}

void loop() {
  lv_timer_handler();
}

void Main_Menu_Init() {
  mainMenu = lv_obj_create(lv_screen_active());
  lv_scr_load(mainMenu);
  lv_obj_set_size(mainMenu, Display.width(), Display.height());
  lv_obj_set_style_bg_color(mainMenu, lv_color_hex(0x323232), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_color(mainMenu, lv_color_hex(0x323232), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_width(mainMenu, 1, LV_PART_MAIN | LV_STATE_DEFAULT);

  Title_bar = lv_obj_create(mainMenu);
  lv_obj_set_size(Title_bar, 800, 6);
  lv_obj_set_pos(Title_bar, 0, -196);
  lv_obj_set_align(Title_bar, LV_ALIGN_CENTER);
  lv_obj_clear_flag(Title_bar, LV_OBJ_FLAG_SCROLLABLE);  /// Flags
  lv_obj_set_style_bg_color(Title_bar, lv_color_hex(0x00A3C8), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_bg_opa(Title_bar, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_color(Title_bar, lv_color_hex(0x323232), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_opa(Title_bar, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_border_width(Title_bar, 1, LV_PART_MAIN | LV_STATE_DEFAULT);

  Title_txt = lv_label_create(mainMenu);
  lv_obj_set_size(Title_txt, LV_SIZE_CONTENT, LV_SIZE_CONTENT);  /// 1
  lv_obj_set_pos(Title_txt, -2, -218);
  lv_obj_set_align(Title_txt, LV_ALIGN_CENTER);
  lv_obj_set_style_text_font(Title_txt, &lv_font_montserrat_36, LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_obj_set_style_text_color(Title_txt, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
  lv_label_set_text(Title_txt, "Stentie Box v0.2");

  LV_IMAGE_DECLARE(frog);
  lv_obj_t * imgTest = lv_image_create(lv_screen_active());
  lv_image_set_src(imgTest, &frog);
  lv_obj_align(imgTest, LV_ALIGN_CENTER, 0, 0);
 }

For anyone that may have the same issues as me later and finds this; I figured out my problem by really breaking down the Arduino Giga Display LVGL image example and a bit more beating my head against a wall:

  1. The github version of the LVGL image converter gives a better image to c array file with more image color depth options (though it is much larger) https://lvgl.github.io/lv_img_conv/

  2. The resultant .c file should be put in the project folder with the .ino file but it should not be added to the arduino project header (don’t add #include "my_image.c"), this tries to compile it as C++(?) which causes the compile errors in the .header properties. The file need only be referenced by LV_IMG_DECLARE and that will work.