1 |
- function s(i){const o=i.split(","),a=o[0].match(/:(.*?);/)[1],r=window.atob(o[1]);let t=r.length;const e=new Uint8Array(t);for(;t--;)e[t]=r.charCodeAt(t);return new Blob([e],{type:a})}function l(i,o){return new Promise((a,r)=>{let t=document.createElement("CANVAS");const e=t.getContext("2d"),n=new Image;n.crossOrigin="",n.onload=function(){if(!t||!e)return r();t.height=n.height,t.width=n.width,e.drawImage(n,0,0);const c=t.toDataURL(o||"image/png");t=null,a(c)},n.src=i})}export{s as d,l as u};
|