修复了文件名中的点号'.'对文件扩展的影响

dev
Dawn_Ocean 2023-10-22 20:15:19 +08:00
parent 6e3b1d7ddc
commit d1b679a1db
1 changed files with 2 additions and 1 deletions

View File

@ -36,7 +36,8 @@ def convert_img(path = os.path.abspath('.')):
return 1
elif file.endswith('.jpg') or file.endswith('.jpeg'):
img = Image.open(path + '\\' + file)
img.save(path + '\\' + file.split('.')[0] + ".png", "PNG")
dot_index = file.rfind('.')
img.save(path + '\\' + file[dot_index:] + ".png", "PNG")
def gen_filelist(path = os.path.abspath('.')):