function saveCanvas() {var typ="png",dat="",img=$('picture'); dat=img.toDataURL("image/jpeg"); typ='jpeg'; window.open(dat=img.toDataURL()); }