PIL的resize

from PIL import Image
img = Image.open(‘D:\image_for_test\Spee.jpg’)
print(“初始尺寸”,img.size)
print(“默认缩放NEARESET”,img.resize((128,128)).size)
print(“BILINEAR”,img.resize((127,127),Image.BILINEAR).size)
print(“BICUBIC”,img.resize((126,126),Image.BICUBIC).size)
print(“ANTIALIAS”,img.resize((125,125),Image.ANTIALIAS).size)

双线性差值,只考虑了旁边4个的点,并且是用的加权平均
双三次插值,考虑了16个点,做加权平均
抗锯齿插值,会考虑所有影响到的像素点,反正很大

你可能感兴趣的:(PIL的resize)