2021年5月5日星期三

How to save a file to a certain directory

I am trying to save a picture to a folder in a directory. I have a button in tkinter that has a command that takes a picture of a camera output. I need to be able to save that picture in a specific file so that my facial recognition can train on them. I cant figure out how to have the image save to the folder. Any help is greatly appreciated.

CODE:

def take_picture():    name_gotten = name_box.get()  directory = f'{name_gotten}'  parent_dir = 'C:/OCV/real-time FR'  path = os.path.join(parent_dir, directory)  os.mkdir(path)    image1 = Image.fromarray(img1)  time = str(datetime.datetime.now().today()).replace(':',' ') + '.jpg'  image1.save(f'{path}', time)  

I am having with the last couple lines. Plz help

https://stackoverflow.com/questions/67410623/how-to-save-a-file-to-a-certain-directory May 06, 2021 at 09:07AM

没有评论:

发表评论