Skip to content

Commit 1e8091e

Browse files
committed
Added a script for a welcome message image (WIP)
1 parent e410595 commit 1e8091e

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

python/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
maturin
22
mypy
3+
pillow
34
pyinstaller
45
requests
56
ruff

scripts/generate_pyxel_thanks

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env python3
2+
3+
import io
4+
import json
5+
import os
6+
import pathlib
7+
8+
import PIL
9+
import requests
10+
11+
ROOT_DIR = ".."
12+
PYXEL_USER_EXAMPLES_JSON = "docs/pyxel_user_examples.json"
13+
14+
15+
def download_gif_frame(url, frame):
16+
response = requests.get(url)
17+
if response.status_code != 200:
18+
raise Exception(f"HTTP error: {response.status_code}")
19+
gif = PIL.Image.open(io.BytesIO(response.content))
20+
gif.seek(frame)
21+
return gif.copy()
22+
23+
24+
def generate_pyxel_thanks():
25+
os.chdir(pathlib.Path(__file__).parent / ROOT_DIR)
26+
with open(PYXEL_USER_EXAMPLES_JSON, "r", encoding="utf-8") as f:
27+
data = json.load(f)
28+
29+
30+
if __name__ == "__main__":
31+
generate_pyxel_thanks()

0 commit comments

Comments
 (0)