Done.  (I put it in image.py though, rather than here.)