add a saving function for canvas