99re热这里只有精品视频,7777色鬼xxxx欧美色妇,国产成人精品一区二三区在线观看,内射爽无广熟女亚洲,精品人妻av一区二区三区

Pillow Image模塊實(shí)例

2021-07-12 15:55 更新

打開、旋轉(zhuǎn)和顯示圖像(使用默認(rèn)查看器)

下面的腳本加載圖像,將其旋轉(zhuǎn)45度,并使用外部查看器(通常是UNIX上的xv,以及Windows上的paint程序)顯示它。

from PIL import Image
im = Image.open("bride.jpg")
im.rotate(45).show()

創(chuàng)建縮略圖

下面的腳本創(chuàng)建當(dāng)前目錄中所有JPEG圖像的漂亮縮略圖,保留最大分辨率為128x128的縱橫比。

from PIL import Image
import glob, os

size = 128, 128

for infile in glob.glob("*.jpg"):
    file, ext = os.path.splitext(infile)
    im = Image.open(infile)
    im.thumbnail(size)
    im.save(file + ".thumbnail", "JPEG")


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)