Pillow in Python

Pillow in Python is another important parameter used by different programmers in performing different tasks. Learn more about it here.

Read Image File

from PIL import Image
im = Image.open("Image.bmp")

Convert files to JPEG

from future import print_function
import os, sys
from PIL import Image
for infile in sys.argv[1:]:
f, e = os.path.splitext(infile)
outfile = f + ".jpg"
if infile != outfile:
try:
Image.open(infile).save(outfile)
except IOError:
print("cannot convert", infile)

Leave a Comment