Add support for loading images from buffer

Suggested by issue #5