How to add c-source image files to assets

What do you want to achieve?

I am working on Elecrow’s excellent LvGL - SquareLine Studio Tutorial and I want to implement the example here. In this example I need to add some png images to assets folder but the source repo has ui_img_X_png.c files only, not .png files.

What have you tried so far?

I tried to add ui_img_X_png.c files but it doesn’t work (as expected). I searched an online or offline converter to convert png.c c-source image files to .png but I couldn’t. Therefore I am asking a solution here.

Screenshot or video


  • SquareLine Studio version:
  • Operating system:
    Windows 11
  • Target hardware:
    Arduino with TFT_eSPI ( to run on Maferfabs MaTouch_ESP32-S3 Parallel TFT with Touch 3.5’’ ILI9488 board )

The png.c files are generated from png files (by SquareLine Studio’s built-in image-converter) and are not in png format. I think there’s no converter that converts this special LVGL-tailored format back to png. (This of course doesn’t keep you from making PNGs from the screenhots shown on the example page.)
So unless you get the original png files for the example (maybe they’re shared somewhere) you’ll need to add your own png files to the assets. (This will convert them to png.c. Or you can go with the more advanced way of using png or LVGL-compatibel binary image files converted from them as file-assets if that’s what you want.)

Great idea, thank you very much. How could I not have thought of this? The images I will get from the screen will be enough for my tutorial experiment !

Furthermore I understand that after I finalize the design I can replace the generated png.c files with the original png.c files for better resolution.

1 Like