And I added the writeImage function.