From d1b679a1db4c38fe31de8338595593d44ab93b47 Mon Sep 17 00:00:00 2001 From: Dawn_Ocean <1785590531@qq.com> Date: Sun, 22 Oct 2023 20:15:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E4=B8=AD=E7=9A=84=E7=82=B9=E5=8F=B7'.'=E5=AF=B9?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=89=A9=E5=B1=95=E7=9A=84=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index b9706ef..0d750b1 100644 --- a/main.py +++ b/main.py @@ -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('.')):