def AffineScale(scale,new_size,center=None,filter=BILINEAR):
'''
Create a simple scale transform.
@param scale: the amount to scale the image.
@param new_size: new size for the image.
@param filter: PIL filter to use.
'''
matrix = array([[scale,0,0],[0,scale,0],[0,0,1]],'d')
scale = AffineTransform(matrix,new_size,filter)
if center == None:
return scale
else:
return AffineTranslate(center.X(),center.Y(),new_size)*scale*AffineTranslate(-center.X(),-center.Y(),new_size)
评论列表
文章目录