Added renderToFile() and split out a createImage() private method