Implementieren der PWA, Multi-Instanzen-Passwort-Schutz und Kassen-Löschfunktion
This commit is contained in:
36
gen_icons.py
Normal file
36
gen_icons.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import os
|
||||
|
||||
def create_icon(size, filename):
|
||||
# Create a red square
|
||||
img = Image.new('RGB', (size, size), color='#dc3545')
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
||||
# Try to draw a simple 'E' in the center as a fallback if no emoji font
|
||||
# Calculate approximate font size
|
||||
font_size = int(size * 0.6)
|
||||
try:
|
||||
# standard windows font
|
||||
font = ImageFont.truetype("arialbd.ttf", font_size)
|
||||
except IOError:
|
||||
font = ImageFont.load_default()
|
||||
|
||||
text = "E"
|
||||
# Get bounding box
|
||||
left, top, right, bottom = draw.textbbox((0, 0), text, font=font)
|
||||
text_w = right - left
|
||||
text_h = bottom - top
|
||||
|
||||
x = (size - text_w) / 2
|
||||
y = (size - text_h) / 2
|
||||
|
||||
draw.text((x, y), text, fill=(255, 255, 255), font=font)
|
||||
|
||||
# Save the image
|
||||
filepath = os.path.join('static', filename)
|
||||
img.save(filepath)
|
||||
print(f"Saved {filepath}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
create_icon(192, 'icon-192x192.png')
|
||||
create_icon(512, 'icon-512x512.png')
|
||||
Reference in New Issue
Block a user