「App:Library:LVGL:docs:3rd party libraries:JPG decoder」の版間の差分
提供: robot-jp wiki
ナビゲーションに移動検索に移動50行目: | 50行目: | ||
|- | |- | ||
| | | | ||
− | 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<syntaxhighlight lang="C++" style="border:1px dashed gray;"> | + | If enabled in <code style="color: #bb0000;">lv_conf.h</code> by <code style="color: #bb0000;">LV_USE_SJPG</code> LVGL will register a new image decoder automatically so JPG and SJPG<syntaxhighlight lang="C++" style="border:1px dashed gray;"> |
files can be directly used as image sources. For example: | 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"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | 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 style="color: #bb0000;">lv_conf.h</code> with <code style="color: #bb0000;">LV_USE_FS_...</code> |
− | |LVGLで有効に<code>lv_conf.h</code>する<code>LV_USE_SJPG</code>と、新しい画像デコーダーが自動的に登録されるため、JPGとSJPG | + | |LVGLで有効に<code style="color: #bb0000;">lv_conf.h</code>する<code style="color: #bb0000;">LV_USE_SJPG</code>と、新しい画像デコーダーが自動的に登録されるため、JPGとSJPG |
ファイルは 画像ソースとして直接使用でき ます 。例:lv_img_set_src (my_img 、 "S:path / to / picture.jpg" ); | ファイルは 画像ソースとして直接使用でき ます 。例:lv_img_set_src (my_img 、 "S:path / to / picture.jpg" ); | ||
− | ファイルからイメージを開くには、ファイルシステムドライバを登録する必要があることに注意してください。詳細についてはこちらをご覧になるか、で有効に<code>lv_conf.h</code>してください<code>LV_USE_FS_...</code> | + | ファイルからイメージを開くには、ファイルシステムドライバを登録する必要があることに注意してください。詳細についてはこちらをご覧になるか、で有効に<code style="color: #bb0000;">lv_conf.h</code>してください<code style="color: #bb0000;">LV_USE_FS_...</code> |
|} | |} | ||
:[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]] | :[[App:Library:LVGL:docs:3rd party libraries|戻る : Previous]] | ||
86行目: | 86行目: | ||
|- | |- | ||
| | | | ||
− | 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 style="color: #bb0000;">pip3 install pillow</code>) |
To create SJPG from JPG: | To create SJPG from JPG: | ||
− | * Copy the image to convert into <code>lvgl/scripts</code> | + | * Copy the image to convert into <code style="color: #bb0000;">lvgl/scripts</code> |
− | * <code>cd lvgl/scripts</code> | + | * <code style="color: #bb0000;">cd lvgl/scripts</code> |
− | * <code>python3 jpg_to_sjpg.py image_to_convert.jpg</code>. It creates both a C files and an SJPG image. | + | * <code style="color: #bb0000;">python3 jpg_to_sjpg.py image_to_convert.jpg</code>. It creates both a C files and an SJPG image. |
The expected result is: | The expected result is: | ||
110行目: | 110行目: | ||
All good! | All good! | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | | | ||
+ | |} | ||
+ | |||
== Example == | == Example == | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
=== 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]] | ||
117行目: | 125行目: | ||
− | python3とPILライブラリが必要です。(PILはでインストールできます<code>pip3 install pillow</code>) | + | python3とPILライブラリが必要です。(PILはでインストールできます<code style="color: #bb0000;">pip3 install pillow</code>) |
JPGからSJPGを作成するには: | JPGからSJPGを作成するには: | ||
− | * 変換する画像をコピーします<code>lvgl/scripts</code> | + | * 変換する画像をコピーします<code style="color: #bb0000;">lvgl/scripts</code> |
− | * <code>cd lvgl/scripts</code> | + | * <code style="color: #bb0000;">cd lvgl/scripts</code> |
− | * <code>python3 jpg_to_sjpg.py image_to_convert.jpg</code>。CファイルとSJPG画像の両方を作成します。 | + | * <code style="color: #bb0000;">python3 jpg_to_sjpg.py image_to_convert.jpg</code>。CファイルとSJPG画像の両方を作成します。 |
期待される結果は次のとおりです。 | 期待される結果は次のとおりです。 |
2022年6月29日 (水) 15:25時点における版
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. |
LVGLでJPG画像の使用を許可します。それに加えて、Split JPG(SJPG)と呼ばれるカスタム形式を使用することもできます。これは、組み込みシステムでより最適な方法でデコードできます。 |
Overview
英文 | 自動翻訳 |
---|---|
|
|
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 |
LVGLで有効にlv_conf.h するLV_USE_SJPG と、新しい画像デコーダーが自動的に登録されるため、JPGとSJPG
ファイルは 画像ソースとして直接使用でき ます 。例:lv_img_set_src (my_img 、 "S:path / to / picture.jpg" ); ファイルからイメージを開くには、ファイルシステムドライバを登録する必要があることに注意してください。詳細についてはこちらをご覧になるか、で有効に |
Converter
Converting JPG to C array
英文 | 自動翻訳 |
---|---|
|
|
Converting JPG to SJPG
英文 | 自動翻訳 |
---|---|
python3 and the PIL library required. (PIL can be installed with To create SJPG from JPG:
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 |
JPGからSJPGを作成するには:
期待される結果は次のとおりです。 変換 を開始しました... 入力: image_to_convert 。jpg RES = 640 x 480 出力: 所要時間 = 1.66秒のビンサイズ= 77.1KB の壁紙。sjpg (binファイル)壁紙。c (c配列) すべて 良いです! |
API
英文 | 自動翻訳 |
---|---|
Functions
|