Introduction
Image Module提供了一个表示 PIL 图像的类,Image Module提供了一系列的函数操作,包括加载图像,创建新图像等。
使用 PIL 的 Image Module 需要import
from PIL import Image
Function
Image Module 提供了一系列的函数用于图像操作。
new
Image.new(mode, size)→image
Image.new(mode, size, color)→image
根据指定的mode和size创建一副图像,size通过tuple定义(width, height)。
im = Image.new("RGB", (512, 512), "white")
open
Image.open(file)→image
Image.open(file, mode)→image