Working with PIL
The pillow or PIL is a popular library for working with images in python. You could install via PIP package,
pip install pillowImport the image module in PIL
from PIL import ImageLoad the image and create a PIL image object
image_ = Image.open("my_image.jpg")Plot the image using show() or matplotlib
image_.show(title="my_image.jpg")Image shown outside of the notebook

import matplotlib.pyplot as plt
plt.imshow(image_)Good to Know
- The attribute format tells the extension or format of the image
- The attribute size is the number of pixels that make up the width and height
- The attribute mode is the color space
image.format
image.size #(represents a tuple width and height)
image.mode
![]()
Views: 4