import cv2
import os
import numpy as np
def resize():
path = 'D:\src'
d_path = 'D:\save_image'
filelist = os.listdir(path)
i = 1
for item in filelist:
if item.endswith('.jpg'):
src = os.path.join(os.path.abspath(path), item)
dst = os.path.join(os.path.abspath(d_path), ''+str(i) + '.jpg')
i += 1
src_img = cv2.imdecode(np.fromfile(src,dtype = np.uint8),-1)
dest_img = cv2.resize(src_img,(64,64),interpolation = cv2.INTER_CUBIC)
cv2.imwrite(dst,dest_img)
if __name__ == "__main__":
resize()