mirror of
https://codeberg.org/Nixietab/EOSSDK-Holos.git
synced 2026-08-21 20:23:28 -04:00
Created launcher to manage the config
This commit is contained in:
parent
2cf9a9756a
commit
98af2b4034
7 changed files with 630 additions and 0 deletions
31
Launcher/gen_icon.py
Normal file
31
Launcher/gen_icon.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import struct, os
|
||||
from io import BytesIO
|
||||
from PIL import Image
|
||||
|
||||
SRC = os.path.join(os.path.dirname(__file__), "holos.png")
|
||||
DST = os.path.join(os.path.dirname(__file__), "icon.ico")
|
||||
SIZES = [16, 24, 32, 48, 64, 128, 256]
|
||||
|
||||
src = Image.open(SRC).convert("RGBA")
|
||||
entries = []
|
||||
|
||||
for size in SIZES:
|
||||
img = src.resize((size, size), Image.LANCZOS)
|
||||
buf = BytesIO()
|
||||
img.save(buf, format='PNG')
|
||||
data = buf.getvalue()
|
||||
w = size if size < 256 else 0
|
||||
h = size if size < 256 else 0
|
||||
entries.append((w, h, 32, len(data), data))
|
||||
|
||||
with open(DST, 'wb') as f:
|
||||
f.write(struct.pack('<HHH', 0, 1, len(SIZES)))
|
||||
dir_offset = 6 + len(SIZES) * 16
|
||||
for entry in entries:
|
||||
f.write(struct.pack('<BBBBHHII',
|
||||
entry[0], entry[1], 0, 0, 1, entry[2], entry[3], dir_offset))
|
||||
dir_offset += entry[3]
|
||||
for entry in entries:
|
||||
f.write(entry[4])
|
||||
|
||||
print(f"Created {DST} ({os.path.getsize(DST)} bytes, {len(SIZES)} sizes)")
|
||||
Loading…
Add table
Add a link
Reference in a new issue