Allow the use of JPG images in LVGL. Besides that it also allows the use of a custom format, called Split JPG (SJPG), which can be decoded in more optimal way on embedded systems.
If enabled in lv_conf.h
by LV_USE_SJPG
LVGL will register a new image decoder automatically so JPG and SJPG files can be directly used as image sources. For example:
lv_img_set_src(my_img, "S:path/to/picture.jpg");
Note that, a file system driver needs to registered to open images from files. Read more about it here or just enable one in lv_conf.h
with LV_USE_FS_...
python3 and the PIL library required. (PIL can be installed with pip3 install pillow
)
To create SJPG from JPG:
lvgl/scripts
cd lvgl/scripts
python3 jpg_to_sjpg.py image_to_convert.jpg
. It creates both a C files and an SJPG image.The expected result is:
Conversion started...
Input:
image_to_convert.jpg
RES = 640 x 480
Output:
Time taken = 1.66 sec
bin size = 77.1 KB
walpaper.sjpg (bin file)
walpaper.c (c array)
All good!
.. include:: ../../examples/libs/sjpg/index.rst
```eval_rst
.. doxygenfile:: lv_sjpg.h :project: lvgl