PILLOW

What it is good for?

Image manipulation.

PILLOW is the inofficial successor to the Python Imaging Library (PIL). It facilitates creating, cutting and applying various filters to pixel-based images.

Installed with Python by default

no

Installed with Anaconda

yes

How to install it?

  1. pip install pillow

Example

Convert all .png images in the directory to half their size.

  1. from PIL import Image
  2. import os
  3. for filename in os.listdir('.'):
  4. if filename.endswith('.png'):
  5. im = Image.open(filename)
  6. x = im.size[0] // 2
  7. y = im.size[1] // 2
  8. small = im.resize((x, y))
  9. small.save('sm_' + filename)

Where to learn more?

https://pillow.readthedocs.org