Store image data in memory before writing it