首页 > 编程 > Python > 正文

python 获取图片分辨率的方法

2019-11-25 13:31:43
字体:
来源:转载
供稿:网友

pil版:

from PIL import Imagefilename = r'E:/data/yangben/0.jpg'img = Image.open(filename)imgSize = img.size #图片的长和宽print (imgSize)maxSize = max(imgSize) #图片的长边minSize = min(imgSize) #图片的短边print(maxSize, minSize)

opencv版:

img = cv2.imread(F1)sp = img.shapeheight = sp[0] # height(rows) of imagewidth = sp[1] # width(colums) of imagechanael = sp[2] # the pixels value is made up of three primary colorsprint ( 'width: %d /nheight: %d /nnumber: %d' % (width, height, chanael))

以上这篇python 获取图片分辨率的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持武林网。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表