This commit is contained in:
2025-03-07 15:32:58 +08:00
commit 73d42bbccf
20 changed files with 3735 additions and 0 deletions

43
create_icon.py Normal file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2025 Any2MIF Project
# All rights reserved.
"""
Any2MIF - 图标生成脚本
创建一个简单的图标文件,用于打包时使用
"""
import os
from PIL import Image, ImageDraw, ImageFont
def create_icon():
"""创建一个简单的图标文件"""
# 创建一个32x32像素的图像背景为透明
img = Image.new('RGBA', (256, 256), color=(0, 0, 0, 0))
draw = ImageDraw.Draw(img)
# 绘制一个圆形背景
draw.ellipse((16, 16, 240, 240), fill=(41, 128, 185))
# 绘制文字
try:
# 尝试加载系统字体
font = ImageFont.truetype("arial.ttf", 120)
except IOError:
# 如果无法加载系统字体,使用默认字体
font = ImageFont.load_default()
# 绘制"A2M"文字
draw.text((50, 70), "AM", fill=(255, 255, 255), font=font)
# 确保resources目录存在
if not os.path.exists("resources"):
os.makedirs("resources")
# 保存为.ico文件
img.save("resources/icon.ico", format="ICO", sizes=[(16, 16), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)])
print(f"图标文件已创建:{os.path.abspath('resources/icon.ico')}")
if __name__ == "__main__":
create_icon()