from PIL import Image

In this article, you’ll see how to import the PIL module in Python and why we import PIL instead of Pillow. You will also know why we use “from PIL import Image“. If you want to learn Computer Vision then I will highly recommend you to read This book.

Import Pillow library

The following code will import the entire PIL library in Python.

import PIL

from PIL import Image

You should use the following code to import the PIL module because it will not import the entire PIL library. The reason for using PIL instead of Pillow is that it will be compatible with the older module called Python Imaging Library (PIL).

from PIL import Image

Leave a Comment

Your email address will not be published.