Export to image file.

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

        Returns
        -------
        self

def to_file(self, filename):
        """Export to image file.

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

        Returns
        -------
        self
        """

        img = self.to_image()
        img.save(filename, optimize=True)
        return self