PIL get image code example
Example 1: pil get image type
img = Image.open(filename)
print(img.format)
Example 2: convert rgb image to binary in pillow
from PIL import Image
image_file = Image.open("cat-tied-icon.png")
image_file = image_file.convert('1')
image_file.save('/tmp/result.png')
Example 3: pil python image
from PIL import Image
im = Image.open("bride.jpg")
im.rotate(45).show()
Example 4: 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")