Updated to be pillow compatible
Updated for python3