Added support for Python 3 and switched from PIL to Pillow.