Lv100版本源码上传

This commit is contained in:
西瓜°
2024-11-04 14:45:20 +08:00
parent a98bdaf4e0
commit a6dbccdead
3431 changed files with 139917 additions and 75 deletions
+19
View File
@@ -0,0 +1,19 @@
from PIL import Image
import os
path = []
for files in os.listdir('./'):
path.append(files)
for i in path:
if '.png' in i or '.jpg' in i:
img = Image.open(i)
if img.size == (28, 28):
temp = img.convert("RGBA")
pim = temp.load()
pim[0, 0] = (255, 255, 255, 0)
pim[27, 0] = (255, 255, 255, 0)
pim[0, 27] = (255, 255, 255, 0)
pim[27, 27] = (255, 255, 255, 0)
temp.save(i.replace('.jpg', '.png'))
Binary file not shown.
+52
View File
@@ -0,0 +1,52 @@
# Gif:导出图标所在
# Icon:需要合成的图标
# Top:特效所在文件夹,从1开始,后缀png
# Temp:临时文件夹
# 注意:ICON需要和TOP中的宽度、高度、位深度相同
from skimage import io
import shutil
import imageio
import os
import math
import numpy as np
# 线性减淡
def Linear_dodge(img_1, img_2):
img = img_1 + img_2
mask_2 = img > 1
img = img * (1 - mask_2) + mask_2
return img
def compose_gif(img_paths, fileName):
gif_images = []
for path in img_paths:
gif_images.append(imageio.imread(path))
# 间隔100毫秒
imageio.mimsave("Gif/" + fileName[:-4] + ".gif", gif_images, duration=0.1)
if not os.path.exists("Temp"):
os.mkdir("Temp")
Top_List = os.listdir("Top/")
for file in os.listdir("Icon"):
file_path = os.path.join("Icon/", file)
if not os.path.isdir(file_path):
img_2 = io.imread(file_path)
img_2 = img_2 / 255.0
img_paths = []
for i in range(1, len(Top_List)):
file_name = os.path.join("Top/", str(i) + '.png')
img_1 = io.imread(file_name)
img_1 = img_1 / 255.0
img = Linear_dodge(img_1, img_2)
io.imsave('Temp\\' + str(i) + '.png', img)
img_paths.append('Temp\\' + str(i) + '.png')
compose_gif(img_paths, file)
shutil.rmtree('Temp')
os.mkdir("Temp")
Binary file not shown.