python创建icon图标

2022-12-05,,,

def extension_replace(path,extension):
for i in range(1,len(path)):
if (path[-i] == '.'):
new_path = path.replace(path[-i+1:],extension)
break
return new_path path = '1.jpg'
img = PIL.Image.open(path)
size = (128,128)
icon = img.resize(size,PIL.Image.LANCZOS) #提取像素
name = extension_replace(path,'ico') #替换文件后缀名
icon.save(name)

python创建icon图标的相关教程结束。

《python创建icon图标.doc》

下载本文的Word格式文档,以方便收藏与打印。