Convert image to C array automatically on code

Description

  How to convert an image (JPEG || PNG || BMP || RAWRGB) to C array, specially to RGB565 (Color depth 16 bits) and fit it on Uint8_t to automatically create an image using lv_img_dsc_t?  

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

  RP2040 MCU Board, With 1.28inch Round LCD

What LVGL version are you using?

 8.3.6

What do you want to achieve?

Pass an image via bluetooth, convert it to Uint8_t ( only need "#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP == 0

/Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit" part) that fits on lv_img_dsc_t data

What have you tried so far?

 I've tried to replicate convert.ts provided on github but i did not understand it, but like, now i'm kinda thinking to send a image like jpeg, save the file and then use the JPG decoder.

Code to reproduce

void processReceivedImage(const uint8_t *decodedImageData){
  
  lv_img_dsc_t my_img_dsc = {
    .header.always_zero = 0,
    .header.w = 240,
    .header.h = 240,
    .data_size = 240 * 240 * LV_COLOR_DEPTH / 8,
    .header.cf = LV_IMG_CF_TRUE_COLOR,          /*Set the color format*/
    .data = decodedImageData,
};
  lv_img_set_src(ui_Image2, &my_img_dsc);
}