Taking care of image buffers.
Merge pull request #2 from wangjohn/master

Taking care of image buffers.