new pil image code example
Example 1: pil resize image
im = Image.open('image.jpg')
im = im.resize((w, h))
Example 2: convert rgb image to binary in pillow
from PIL import Image
col = Image.open("cat-tied-icon.png")
gray = col.convert('1')
bw.save("result_bw.png")