I want to write a script that reads the width and height of the picture. As a result, I use cv2 and PIL. After the imageio module is packaged with pyinstaller, the size is above 300mb. I am mad. The
final result uses the matplotlib module. The package result is 4.6mb. Yeah.
# 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)