write images to disk