Reputation: 176
Images
is a folder which have 10 more sub folders and every sub folder have one image which i am resizing and saving on same place but os.walk
is not working can anyone check what i did wrong.
path='E:/Dataset_Final/Images/'
def count_em(path):
for root, dirs, files in sorted(os.walk(path)):
for file_ in files:
full_file_path = os.path.join(root, file_)
print (full_file_path)
img = Image.open(full_file_path)
new_width = 32
new_height = 32
img = img.resize((new_width, new_height), Image.ANTIALIAS)
img.save(os.path.join(root, file_+''),'png')
return
count_em(path)
Upvotes: 0
Views: 527
Reputation: 6272
You return
after the first directory.
Remove the return statement and your code should work as expected.
Upvotes: 1