In this article, you’ll see how to find the mode and type of an image in the PIL module. You just have to change the name and location of the image.
# Import the PIL library
from PIL import Image
# Read the image from location
image = Image.open("C:\\AiHints\\cats.jpg")
# Print the mode of an image
print(image.mode)
# Print the type of an image
print(type(image))Output:
RGB <class 'PIL.JpegImagePlugin.JpegImageFile'>
Recommendation: Computer Vision: Models, Learning, and Inference Book


