def to_file(self, filename):
img = self.to_image()<EOL>img.save(filename, optimize=True)<EOL>return self<EOL>
Export to image file.

        Parameters
        ----------
        filename : string
            Location to write to.

        Returns
        -------
        self