25 lines
808 B
Python
25 lines
808 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
from PIL import Image
|
|
import cairosvg
|
|
|
|
# Pfad zum SVG-Favicon
|
|
svg_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'favicon.svg')
|
|
# Ausgabepfad für das PNG
|
|
png_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'favicon.png')
|
|
# Ausgabepfad für das ICO
|
|
ico_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'favicon.ico')
|
|
|
|
# SVG zu PNG konvertieren
|
|
cairosvg.svg2png(url=svg_path, write_to=png_path, output_width=512, output_height=512)
|
|
|
|
# PNG zu ICO konvertieren
|
|
img = Image.open(png_path)
|
|
img.save(ico_path, sizes=[(16, 16), (32, 32), (48, 48), (64, 64), (128, 128)])
|
|
|
|
print(f"Favicon erfolgreich erstellt: {ico_path}")
|
|
|
|
# Optional: PNG-Datei löschen, wenn nur ICO benötigt wird
|
|
# os.remove(png_path) |