Fix appending to images

It looks like a method got pulled out of a class to become a function, but its `self` parameter wasn't removed. This adds a test to exercise the code as well.