write out the images