想要写个读取图片宽高的脚本,结果使用cv2和PIL,imageio模块在用pyinstaller打包后,大小都在300mb以上,气死了,
最终结果使用matplotlib 模块,打包结果为4.6mb,这才对嘛.
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23# coding:utf-8 import cv2 import imageio from scipy import misc from PIL import Image from matplotlib import pyplot as plt image_path = "./images/000011.jpg" # 使用pillow读取图片,获取图片的宽和高 img_pillow = Image.open(image_path) img_width = img_pillow.width # 图片宽度 img_height = img_pillow.height # 图片高度 print("width -> {}, height -> {}".format(img_width, img_height)) img_cv = cv2.imread(image_path) img_imageio = imageio.imread(image_path) img_scipy = misc.imread(image_path) img_matplot = plt.imread(image_path) print(img_cv.shape) print(img_imageio.shape) print(img_scipy.shape) print(img_matplot.shape)
最后
以上就是清脆小熊猫最近收集整理的关于读取图片宽高信息,打包大小最小的模块matplotlib的全部内容,更多相关读取图片宽高信息,打包大小最小内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复