Tiny JPEG Decompressor (TJpgDec)

Allow the use of JPEG (JPG) images in LVGL.

Detailed introduction: TJpgDec

Overview

  • JPEG is decoded in 8x8 tiles.

  • Only baseline JPEG files are supported (no progressive JPEG support).

  • Read from file and C array are implemented.

  • Only the required portions of the JPEG images are decoded, therefore they can't be zoomed or rotated.

Usage

If enabled in lv_conf.h by LV_USE_TJPGD LVGL will register a new image decoder automatically so JPEG files can be used directly as image sources.

For example:

lv_image_set_src(my_img, "S:path/to/picture.jpg");
note:

a file system driver needs to be registered to open images from files. Read more about File System (lv_fs_drv) or just enable one in lv_conf.h with LV_USE_FS_... config.

Converter

Converting JPEG to C array

Example

Load a JPG image

#include "../../lv_examples.h"
#if LV_USE_TJPGD && LV_BUILD_EXAMPLES

/**
 * Load a JPG image
 */
void lv_example_tjpgd_1(void)
{
    lv_obj_t * wp;

    wp = lv_image_create(lv_screen_active());
    /* Assuming a File system is attached to letter 'A'
     * E.g. set LV_USE_FS_STDIO 'A' in lv_conf.h */
    lv_image_set_src(wp, "A:test_img_lvgl_logo.jpg");
    lv_obj_center(wp);
}

#endif

API

lv_tjpgd.h

tjpgd.h

tjpgdcnf.h