Loading and Saving Images in Python

Simple ways to load and save images using PIL, OpenCV, and Matplotib

Renu Khandelwal
Towards Data Science
3 min readMay 26, 2020

--

Prerequisites:

Install PIL, OpenCV, and matplotlib libraries.

Loading image using PIL in a new window

Show() loads the image in a new window

from PIL import Image
img_PIL = Image.open(r'\dogs-v-cats\dog.1.jpg')
img_PIL.show()

Loading image inline using PIL

--

--

A Technology Enthusiast who constantly seeks out new challenges by exploring cutting-edge technologies to make the world a better place!