代码:
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
img=np.array(Image.open("C:\Users\lenovo\Pictures\Saved Pictures\u=2404042546,574440023&fm=26&fmt=auto.webp").convert("L"))
plt.imshow(img,plt.cm.gray)
print(img)
row=(img.shape[0])
print(row)