also mention how to write arrays as image files