The menu's source step now uses a two-step selection (_select_gifs): pick a mode — tick several GIFs (questionary.checkbox), all GIFs in the directory at once, or enter a path manually — then convert them in one batch. Single-GIF selection and the entire command line stay unchanged. - add run_conversions(gifs, template) that reuses the unchanged single-GIF run_conversion() per item, continues on per-GIF errors, and prints an aggregate "Batch complete: X/Y" summary (non-zero exit if any failed) - with multiple GIFs the per-GIF stem is forced as the frame prefix so frames never collide; the prefix prompt is only shown for a single GIF - update README/AGENTS for the multi/all selection and batch behavior Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
55 lines
1.2 KiB
Markdown
55 lines
1.2 KiB
Markdown
# EmbeddedAnimPacker
|
||
|
||
把 GIF 动画拆成 PNG 帧,并逐帧调用 LVGL 的 `LVGLImage.py` 生成 BIN 文件。
|
||
|
||
## 使用
|
||
|
||
建议先创建并启用 Python 虚拟环境:
|
||
|
||
```bash
|
||
python3 -m venv .venv
|
||
. .venv/bin/activate
|
||
```
|
||
|
||
然后安装依赖(Pillow 用于读取 GIF,questionary 用于交互式菜单):
|
||
|
||
```bash
|
||
python3 -m pip install -r requirements.txt
|
||
```
|
||
|
||
## 交互式菜单
|
||
|
||
不带任何参数运行,会进入交互式菜单:从当前目录选择源 GIF(支持**多选或一键全选**,批量转换)、逐项配置参数,最后确认并执行转换:
|
||
|
||
```bash
|
||
python3 EmbeddedAnimPacker.py
|
||
```
|
||
|
||
也可以用 `-i` / `--interactive` 显式进入菜单。菜单仅在进入时才需要 `questionary`;纯命令行用法不依赖它。
|
||
|
||
## 命令行
|
||
|
||
直接传入 GIF 文件即可(行为与以前一致):
|
||
|
||
```bash
|
||
python3 EmbeddedAnimPacker.py boot.gif
|
||
```
|
||
|
||
默认会调用 `lvgl/scripts/LVGLImage.py`,输出到 `littlefs/anim`。
|
||
|
||
常用参数:
|
||
|
||
```bash
|
||
python3 EmbeddedAnimPacker.py boot.gif \
|
||
--lvgl-dir ./lvgl \
|
||
--output-dir ./littlefs/anim \
|
||
--cf RGB565 \
|
||
--compress RLE
|
||
```
|
||
|
||
保留中间 PNG 帧:
|
||
|
||
```bash
|
||
python3 EmbeddedAnimPacker.py boot.gif --keep-frames ./frames
|
||
```
|