ASCII 字符画生成

上传图片
结果

    
,'standard':'\x20.:-=+*#%@','simple':'\x20.oO@','blocks':'\x20░▒▓█'};document['getElementById']('width')['oninput']=a=>document['getElementById']('width-val')['textContent']=a['target']['value'];function convert(){const a=document['getElementById']('file')['files'][0x0];if(!a)return;const b=new Image();b['onload']=()=>{const d=parseInt(document['getElementById']('width')['value']),e=Math['round'](d*(b['height']/b['width'])*0.5),f=document['createElement']('canvas');f['width']=d,f['height']=e;const j=f['getContext']('2d');j['drawImage'](b,0x0,0x0,d,e);const k=j['getImageData'](0x0,0x0,d,e)['data'],l=charsets[document['getElementById']('charset')['value']],m=document['getElementById']('invert')['checked'],n=document['getElementById']('color-mode')['checked'];let o='';for(let q=0x0;q'+(C==='\x20'?' ':C['replace'](/';else o+=C;}o+='\x0a';}const p=document['getElementById']('output');n?p['innerHTML']=o:p['textContent']=o;},b['src']=URL['createObjectURL'](a);}function copyResult(){navigator['clipboard']['writeText'](document['getElementById']('output')['textContent'])['then'](()=>alert('已复制'));}