Add possibility to read image to pre-created buffer, fixes #240