Implemented a write-to-image method.