python 图片加载处理
#python 图片加载处理
#加载库
from PIL import Image
import os
import matplotlib.pyplot as plt
#图片绝对路径
image_path=r"C:\tulip.jpg"
#图片路径是否存在
assert os.path.exists(image_path) ,print(f"{image_path} does not exist")
#加载图片
img=Image.open(image_path)
#显示图片
plt.imshow(img)