! make writeImage asynchronous