Add support for garbage collecting images.