i am trying to save an image png in a folder via os but nothing happens

Viewed 24

i am trying to save an image in a file so first, i open it then save it then i use path.join and the compiler works fine but nothing happens and the image stays where its and the folder stays empty. here is my code: note that directories are written fine because the folder and the image are in the source file and note that the targeted folder is inside another folder

k=Image.open('Screenshot 2022-07-23 210655.png')
k=k.save('b.png')
j=os.path.join('yame','b.png')
1 Answers

You are joining the path parts after the file has already been saved to the current working directory.

try this instead:

k=Image.open('Screenshot 2022-07-23 210655.png')
j=os.path.join('yame','b.png')
k.save(j)
Related