Today the LVGL image converter website was switched to use my new JavaScript-based converter which runs directly in your browser, rather than the old PHP image converter which relied on server-side facilities as well. This improvement has been quite a while in the making and I’m pleased to have finally been able to complete it.
The new converter should be significantly more reliable at parsing images. In the past there have frequently been issues with image formats like indexed PNGs. These should now be handled correctly. In fact, any image which your browser can display should now work without issues with the converter, as it uses your browser’s built-in facilities to read the image.
Some other bonus features:
Big-endian image conversion (only works with “C array” format at the moment).
It is now possible to convert multiple images at once.
Attempting to convert larger images should no longer result in an out-of-memory error.
Please give it a try and be sure to let us know if you encounter any issues!
There is no need to immediately change your workflow if the PHP converter is working for you.
That being said, I have just finished publishing the converter as a proper NPM module, so you should be able to install and use it as follows. You will need to have a relatively recent version of Node.js installed for this to work.
npm install -g lv_img_conv
npx lv_img_conv --help
npx lv_img_conv logo_lvgl.png -o myfile.c -c CF_TRUE_COLOR_ALPHA # convert logo_lvgl.png to myfile.c with true color alpha format
The help option lists all the possible color formats.
You should be able to adapt the last command to a shell script easily.
Just tried installing this as a npm module, but failed. Not sure how to make it work. Attached is a log of all the errors and appreciate some guidance. error log.txt (92.1 KB)
Thanks. The real issue turned out to be that certain Canvas dependencies like GTK and Cairo were missing. Finally able to install this with node 23.8.0