From 64bd9053a25297f7a442ca831c7da5b44bd33f84 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 12 Jun 2024 17:54:40 +1000 Subject: Update LVGL to v9.1.0 --- lib/lvgl/scripts/image_viewer.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 lib/lvgl/scripts/image_viewer.py (limited to 'lib/lvgl/scripts/image_viewer.py') diff --git a/lib/lvgl/scripts/image_viewer.py b/lib/lvgl/scripts/image_viewer.py new file mode 100755 index 00000000..2ce42a20 --- /dev/null +++ b/lib/lvgl/scripts/image_viewer.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +from LVGLImage import LVGLImage +import argparse +import logging +import os + +logging.basicConfig(level=logging.INFO) + +parser = argparse.ArgumentParser(description="LVGL Binary Image Viewer") +parser.add_argument("file", help="the .bin image file") + +args = parser.parse_args() + +name, ext = os.path.splitext(args.file) +if ext != ".bin": + raise ValueError("Only support LVGL .bin image file") + +output = name + ".png" +img = LVGLImage().from_bin(args.file) +img.to_png(output) +logging.info(f"convert {args.file} to {output}") + +if os.name == "posix": + os.system(f"open {output}") +else: + try: + from PIL import Image + except ImportError: + raise ImportError("Need pillow package, do `pip3 install pillow`") + image = Image.open(output) + image.show(title=output) -- cgit v1.2.3