第一种:用Image
root = ''
pic = Image.open(root)
pic = pic.resize((220, 220))
第二种:用cv2
root = ''
crop_size = (320, 480)
img = cv2.imread(root)
img_new = cv2.resize(img, crop_size, interpolation = cv2.INTER_CUBIC)
Note: 参数interpolation不能少
CV_INTER_NN - 最近邻插值,
CV_INTER_LINEAR - 双线性插值 (缺省使用)
CV_INTER_AREA - 使用象素关系重采样。当图像缩小时候,该方法可以避免波纹出现。当图像放大时,类似于 CV_INTER_NN 方法..
CV_INTER_CUBIC - 立方插值.