Pillow is a third-party Python module for working with image files.This module contains functions that make it easy to crop, resize, and edit the content of images.With the ability to manipulate images like Microsoft Paint or Adobe Photoshop, Python can easily and automatically edit thousands of images.
The following is a simple demonstration of some basic uses of the pillow library:
1. Open the image and show it
from PILimport Image
img = Image.open(r'C:\zennerwebsite.png')
img.show()
2. Convert image format
img.save(r’C:\copy.jpg’)
3. Draw text on image
from PILimport ImageFont, ImageDraw
img = Image.open(r'C:\zennerwebsite.png')
img.show()
draw = ImageDraw.Draw(img)
draw.text((10,20), 'Test', fill='yellow')
img.save(r’C:\copy.png’)