Add support for garbage collecting images.

Closes #157 
This anonymous function seems superfluous?