write a random image to a png file