Overview
- Image processing has come to mainstream use through the applications like medical imaging, face detection, tagging of photos, editing and publishing of photos in social media, authentication using fingerprints and facial recognition.
- Pillow is an image-processing library used in Python Programs.
- Pillow has extensive APIs to support image processing which provide methods for
- Geometrical transformations
- Image filtering
- Image enhancement
- Color space conversions of Images
- Statistical analysis of images like histogram
- Processing Image Sequences or Animations formats
- e.g., .FLI, .FLC files, Animated GIF files
- Pillow supports Mac OS, Linux and Windows Operating Systems.
- Pillow supports several of the image file formats including BMP, EPS, GIF, ICNS, IM, JPEG, JPEG 2000, MSP, PCX, PNG, PPM, SPIDER, TIFF, WebP and XBM.
Example: Flipping of an Image
# import image module
from PIL import Image
# Open an already existing image
imageObject = Image.open("./waterfalls.jpg")
# Do a flip of left and right
flippedImage = imageObject.transpose(Image.FLIP_LEFT_RIGHT)
# Show the original image
imageObject.show()
# Show the flipped image
flippedImage.show()Output
Before Flip
Image before flip using pillow image processing library
After Flip
