import os,sys
from PIL import Image
import shutil
src = '/home/mihuzz/PycharmProjects/dc/face'
dst = '/home/mihuzz/PycharmProjects/dc/newface'
size = 224, 224
for root, dirs, files in os.walk(src):
for file in files:
if file.endswith(('png','jpg')):
img = Image.open(os.path.join(root, file)).resize(size, Image.ANTIALIAS)
print(rs.size)
img.save (dst)