2024-01-04 07:25:13 +01:00
|
|
|
.. _lodepng:
|
|
|
|
|
2023-09-20 16:30:04 +08:00
|
|
|
===============
|
2024-01-04 07:25:13 +01:00
|
|
|
LodePNG decoder
|
2023-09-20 16:30:04 +08:00
|
|
|
===============
|
2023-04-27 06:42:02 -06:00
|
|
|
|
2024-01-04 07:25:13 +01:00
|
|
|
Allow the use of PNG images in LVGL.
|
|
|
|
|
2024-01-06 08:34:02 +01:00
|
|
|
Detailed introduction: https://github.com/lvandeve/lodepng
|
2023-04-27 06:42:02 -06:00
|
|
|
|
2023-09-20 16:30:04 +08:00
|
|
|
If enabled in ``lv_conf.h`` by :c:macro:`LV_USE_LODEPNG` LVGL will register a new
|
2023-04-27 06:42:02 -06:00
|
|
|
image decoder automatically so PNG files can be directly used as any
|
|
|
|
other image sources.
|
|
|
|
|
2024-01-06 08:34:02 +01:00
|
|
|
:Note: a file system driver needs to be registered to open images from
|
2024-01-04 07:25:13 +01:00
|
|
|
files. Read more about it :ref:`overview_file_system` or just
|
2023-04-27 06:42:02 -06:00
|
|
|
enable one in ``lv_conf.h`` with ``LV_USE_FS_...``
|
|
|
|
|
2024-01-04 07:25:13 +01:00
|
|
|
The whole PNG image is decoded, so ``width x height x 4`` bytes free RAM space is required.
|
|
|
|
The decoded image is stored in RGBA pixel format.
|
|
|
|
|
|
|
|
As it might take significant time to decode PNG images LVGL's :ref:`overview_image_caching` feature can be useful.
|
|
|
|
|
|
|
|
Compress PNG files
|
|
|
|
------------------
|
2023-04-27 06:42:02 -06:00
|
|
|
|
2024-01-04 07:25:13 +01:00
|
|
|
PNG file format supports True color (24/32 bit), and 8-bit palette colors.
|
|
|
|
Usually cliparts, drawings, icons and simple graphics are stored in PNG format,
|
|
|
|
that do not use the whole color space, so it is possible to compress further
|
|
|
|
the image by using 8-bit palette colors, instead of 24/32 bit True color format.
|
|
|
|
Because embedded devices have limited (flash) storage, it is recommended
|
|
|
|
to compress images.
|
|
|
|
|
2024-01-06 08:34:02 +01:00
|
|
|
One option is to use a free online PNG compressor site,
|
|
|
|
for example Compress PNG: https://compresspng.com/
|
2024-01-04 07:25:13 +01:00
|
|
|
|
|
|
|
.. _lodepng_example:
|
2023-04-27 06:42:02 -06:00
|
|
|
|
|
|
|
Example
|
|
|
|
-------
|
|
|
|
|
2023-09-20 16:30:04 +08:00
|
|
|
.. include:: ../examples/libs/lodepng/index.rst
|
2023-04-27 06:42:02 -06:00
|
|
|
|
2024-01-04 07:25:13 +01:00
|
|
|
.. _lodepng_api:
|
|
|
|
|
2023-04-27 06:42:02 -06:00
|
|
|
API
|
|
|
|
---
|
|
|
|
|
|
|
|
:ref:`lodepng`
|
2023-05-08 08:45:28 -06:00
|
|
|
|