Writes an image or image sequence.