Avoid expanding buffer to fit entire image.

Fixes #225.