ESP LV DECODER
Allow the use of images in LVGL. Besides that it also allows the use of a custom format, called Split image, which can be decoded in more optimal way on embedded systems.
Referencing the implementation of SJPG.
Features
Supports both standard and custom split image formats, including JPG, PNG, and QOI.
Decoding standard image requires RAM equivalent to the full uncompressed image size (recommended for devices with more RAM).
Split image is a custom format based on standard image formats, specifically designed for LVGL.
File reads are implemented for both file storage and C-arrays.
Split images are decoded in segments, so zooming and rotating are not supported.
Usage
The esp_mmap_assets component is required. It automatically packages and converts images to your desired format during compilation.
Converting JPG to SJPG
spiffs_create_partition_assets(
my_spiffs_partition
my_folder
FLASH_IN_PROJECT
MMAP_FILE_SUPPORT_FORMAT ".jpg"
MMAP_SUPPORT_SJPG
MMAP_SPLIT_HEIGHT 16)
Converting PNG to SPNG
spiffs_create_partition_assets(
my_spiffs_partition
my_folder
FLASH_IN_PROJECT
MMAP_FILE_SUPPORT_FORMAT ".png"
MMAP_SUPPORT_SPNG
MMAP_SPLIT_HEIGHT 16)
Converting PNG、JPG to QOI
spiffs_create_partition_assets(
my_spiffs_partition
my_folder
FLASH_IN_PROJECT
MMAP_FILE_SUPPORT_FORMAT ".jpg,.png"
MMAP_SUPPORT_QOI)
Converting PNG、JPG to SQOI
spiffs_create_partition_assets(
my_spiffs_partition
my_folder
FLASH_IN_PROJECT
MMAP_FILE_SUPPORT_FORMAT ".jpg,.png"
MMAP_SUPPORT_QOI
MMAP_SUPPORT_SQOI
MMAP_SPLIT_HEIGHT 16)
Application Examples
Register Decoder
Register the decoder function after LVGL starts.
esp_lv_decoder_handle_t decoder_handle = NULL;
esp_lv_decoder_init(&decoder_handle); //Initialize this after lvgl starts
API Reference
Header File
Functions
-
esp_err_t esp_lv_decoder_init(esp_lv_decoder_handle_t *ret_handle)
Register the decoder functions in LVGL.
- Parameters
ret_handle – Pointer to the handle where the decoder handle will be stored
- Returns
ESP_OK on success
ESP_ERR_* error codes on failure
-
esp_err_t esp_lv_decoder_deinit(esp_lv_decoder_handle_t handle)
Deinitialize the decoder handle.
- Parameters
handle – The handle to be deinitialized
- Returns
ESP_OK on success
ESP_ERR_* error codes on failure
Type Definitions
-
typedef void *esp_lv_decoder_handle_t
Type of handle for the decoder.