Py学习  »  Python

在Python中调整图像大小

Turing • 5 年前 • 1798 次点击  

def process_image(image):

    size = 256, 256
    image.thumbnail(size, Image.ANTIALIAS)
    #image = image.crop((128 - 112, 128 - 112, 128 + 112, 128 + 112))
    npImage = np.array(image)
    npImage = npImage/255.

    return npImage

我希望所有的图片都是一样的大小。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/53759
 
1798 次点击  
文章 [ 2 ]  |  最新文章 5 年前