a package version of esheldon's images.py python functions