发布时间:2019-08-06 09:13:35编辑:auto阅读(2666)
了解过Pillow的都知道,Pillow是一个非常强大的图片处理器,这篇文章主要记录一下Pillow对图片信息的获取:
pip install pillow
import os
from PIL import Image
path = os.path.join(os.getcwd(),"23.png")
img = Image.open(path)
print img.format # PNG
print img.size # (3500, 3500)
path = "http://h.hiphotos.baidu.com/image/pic/item/c8ea15ce36d3d5397966ba5b3187e950342ab0cb.jpg"
file = urllib2.urlopen(path)
tmpIm = cStringIO.StringIO(file.read())
img = Image.open(tmpIm)
print img.format # JPEG
print img.size # (801, 1200)
上一篇: python3之DNS处理模块dnspy
下一篇: Python 如何查询版本号
55120
41923
36504
31909
26814
26485
25023
20646
16554
15968
3182°
2879°
2972°
3122°
3056°
3333°
3232°
3063°
3054°
3034°