要特别注意我们的操作对象是什么
1.
import Image
f = Image.open('test.jpg') #获得图像文件
print f.format, f.size, f.mode #获得图像文件的信息
import Image
f = Image.open('test.jpg')
print f.format, f.size, f.mode
#下面是对图像文件f的操作:提取缩略图,保存结果
f.thumbnail((200, 100))
f.save('thumb.jpg', 'JPEG')
3.
# -*- coding:utf-8 -*-
from PIL import Image
#创建一张画布
width = 60 * 4
height = 60
image = Image.new('RGB', (width, height), (255, 255, 255))
print image.format,image.size,image.mode
image.save('test2.jpg') #保存创建的画布(操作的对象自然是创建的画布image)