You can convert the PIL image to a NumPy array with the following code. If you want to learn Python, I highly recommend reading This Book.

# Import the required module
from PIL import Image
import numpy as np
# Read the Image
image = Image.open("man.jpg")
# Print the type of Image
print(type(image))
# Convert PIL to NumPy array
b = np.asarray(image)
# Display the type of b
print(type(b))Output:
<class 'PIL.JpegImagePlugin.JpegImageFile'> <class 'numpy.ndarray'>


