New image converter

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!

7 Likes

What do you recommend for batch conversions? I am currently using the php with a shell script.

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.

Thanks. I’ll try it out and compare the results.

Yesterday I tried with SVG images, it worked well! :rocket: