「App:Library:LVGL:docs:3rd party libraries:JPG decoder」の版間の差分

提供: robot-jp wiki
ナビゲーションに移動検索に移動
1行目: 1行目:
 
https://docs.lvgl.io/8.2/libs/sjpg.html
 
https://docs.lvgl.io/8.2/libs/sjpg.html
 
__NOTOC__
 
__NOTOC__
 +
= JPG decoder =
 
{| class="wikitable"
 
{| class="wikitable"
 
!英文
 
!英文
6行目: 7行目:
 
|-
 
|-
 
|
 
|
 +
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.
 
|
 
|
 
|}
 
|}
 +
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]]
  
= JPG decoder =
 
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.
 
  
 
== Overview ==
 
== Overview ==
 
+
{| class="wikitable"
 +
!英文
 +
!自動翻訳
 +
|-
 +
|
 
* Supports both normal JPG and the custom SJPG formats.
 
* Supports both normal JPG and the custom SJPG formats.
 
* Decoding normal JPG consumes RAM with the size fo the whole uncompressed image (recommended only for devices with more RAM)
 
* Decoding normal JPG consumes RAM with the size fo the whole uncompressed image (recommended only for devices with more RAM)
24行目: 29行目:
 
* Currently only 16 bit image format is supported (TODO)
 
* Currently only 16 bit image format is supported (TODO)
 
* Only the required partion of the JPG and SJPG images are decoded, therefore they can't be zoomed or rotated.
 
* Only the required partion of the JPG and SJPG images are decoded, therefore they can't be zoomed or rotated.
 +
|
 +
|}
 +
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]]
 +
  
 
== Usage ==
 
== Usage ==
 +
{| class="wikitable"
 +
!英文
 +
!自動翻訳
 +
|-
 +
|
 
If enabled in <code>lv_conf.h</code> by <code>LV_USE_SJPG</code> LVGL will register a new image decoder automatically so JPG and SJPG files can be directly used as image sources. For example:
 
If enabled in <code>lv_conf.h</code> by <code>LV_USE_SJPG</code> 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");
 
  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 <code>lv_conf.h</code> with <code>LV_USE_FS_...</code>
 
Note that, a file system driver needs to registered to open images from files. Read more about it here or just enable one in <code>lv_conf.h</code> with <code>LV_USE_FS_...</code>
 +
|
 +
|}
 +
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]]
 +
  
 
== Converter ==
 
== Converter ==
  
 
=== Converting JPG to C array ===
 
=== Converting JPG to C array ===
 
+
{| class="wikitable"
 +
!英文
 +
!自動翻訳
 +
|-
 +
|
 
* Use lvgl online tool <nowiki>https://lvgl.io/tools/imageconverter</nowiki>
 
* Use lvgl online tool <nowiki>https://lvgl.io/tools/imageconverter</nowiki>
 
* Color format = RAW, output format = C Array
 
* Color format = RAW, output format = C Array
 +
|
 +
|}
 +
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]]
 +
  
 
=== Converting JPG to SJPG ===
 
=== Converting JPG to SJPG ===
 +
{| class="wikitable"
 +
!英文
 +
!自動翻訳
 +
|-
 +
|
 
python3 and the PIL library required. (PIL can be installed with <code>pip3 install pillow</code>)
 
python3 and the PIL library required. (PIL can be installed with <code>pip3 install pillow</code>)
  
47行目: 78行目:
  
 
The expected result is:
 
The expected result is:
 +
<syntaxhighlight lang="C++" style="border:1px dashed gray;">
 
  Conversion started...
 
  Conversion started...
 
   
 
   
60行目: 92行目:
 
   
 
   
 
  All good!
 
  All good!
 +
</syntaxhighlight>
  
 
== Example ==
 
== Example ==
 
=== Load an SJPG image ===
 
=== Load an SJPG image ===
 
[[file:LVGL docs others gridnav 03.png|link=https://docs.lvgl.io/8.2/libs/sjpg.html#load-an-sjpg-image]]
 
[[file:LVGL docs others gridnav 03.png|link=https://docs.lvgl.io/8.2/libs/sjpg.html#load-an-sjpg-image]]
 +
|
 +
|}
 +
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]]
  
----
 
  
 
== API ==
 
== API ==
 +
{| class="wikitable"
 +
!英文
 +
!自動翻訳
 +
|-
 +
|
 
Functions
 
Functions
  
 
; <span id="_CPPv318lv_split_jpeg_initv"></span><span id="_CPPv218lv_split_jpeg_initv"></span><span id="lv_split_jpeg_init__void"></span><span id="lv__sjpg_8h_1a0b3cc161e2b41c694997f6b4ed9e9240" class="target"></span>void lv_split_jpeg_init(void)
 
; <span id="_CPPv318lv_split_jpeg_initv"></span><span id="_CPPv218lv_split_jpeg_initv"></span><span id="lv_split_jpeg_init__void"></span><span id="lv__sjpg_8h_1a0b3cc161e2b41c694997f6b4ed9e9240" class="target"></span>void lv_split_jpeg_init(void)
 +
|
 +
|}
  
  
  
  
 
 
 
 
 
----
 
 
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]]
 
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]]

2022年6月29日 (水) 15:22時点における版

https://docs.lvgl.io/8.2/libs/sjpg.html

JPG decoder

英文 自動翻訳

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.

戻る : Previous


Overview

英文 自動翻訳
  • Supports both normal JPG and the custom SJPG formats.
  • Decoding normal JPG consumes RAM with the size fo the whole uncompressed image (recommended only for devices with more RAM)
  • SJPG is a custom format based on "normal" JPG and specially made for LVGL.
  • SJPG is 'split-jpeg' which is a bundle of small jpeg fragments with an sjpg header.
  • SJPG size will be almost comparable to the jpg file or might be a slightly larger.
  • File read from file and c-array are implemented.
  • SJPEG frame fragment cache enables fast fetching of lines if available in cache.
  • By default the sjpg image cache will be image width * 2 * 16 bytes (can be modified)
  • Currently only 16 bit image format is supported (TODO)
  • Only the required partion of the JPG and SJPG images are decoded, therefore they can't be zoomed or rotated.
戻る : Previous


Usage

英文 自動翻訳

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_...

戻る : Previous


Converter

Converting JPG to C array

英文 自動翻訳
  • Use lvgl online tool https://lvgl.io/tools/imageconverter
  • Color format = RAW, output format = C Array
戻る : Previous


Converting JPG to SJPG

英文 自動翻訳

python3 and the PIL library required. (PIL can be installed with pip3 install pillow)

To create SJPG from JPG:

  • Copy the image to convert into 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!

Example

Load an SJPG image

LVGL docs others gridnav 03.png

戻る : Previous


API

英文 自動翻訳

Functions

void lv_split_jpeg_init(void)



戻る : Previous