【发布时间】:2022-07-18 23:28:26
【问题描述】:
我怎样才能得到没有根和路径的文件名。只有一个名称,以便我可以使用相同的原始名称保存要转换的图像?
import sys
import os,glob
from PIL import Image, ImageFilter
path = os.getcwd()
if not os.path.exists('converted'):
save_to = os.makedirs('converted')
for i in glob.glob(f'{path}/*.jpg'):
img = Image.open(i)
img.save(???????) ######## <---------?????????
#i want to save the imege whith its original name,
# but with a different extention, and i want to save it to a different folder then cwd
【问题讨论】:
标签: python python-3.x