Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[飛込] jsでゴリゴリ画像処理

[飛込] jsでゴリゴリ画像処理

canvas と js で画像処理をするときの Tips 集を飛び込みで喋りました

zk-phi

May 09, 2019
Tweet

More Decks by zk-phi

Other Decks in Programming

Transcript

  1. ը૾ͷੜσʔλΛೖख var canvas = document.createElement(“canvas”); canvas.width = img.naturalWidth; canvas.height =

    img.naturalHeight; var ctx = canvas.getContext(‘2d’); ctx.drawImage(img, 0, 0); var data = ctx.getImageData(0, 0, canvas.width, canvas.height); ɾDUYHFU*NBHF%BUB Ͱ഑ྻ͕औΕΔ
  2. 8FC8PSLFST var worker = new Worker(“worker.js”); worker.addEventListener(‘message’, (e) => {

    switch(e.data.method) { case “finished”: onHogeFinished(); break; ... } }); worker.postMessage(“hoge”, args); self.addEventListener(‘message’, (e) => { switch(e.data.method) { case “hoge”: omoiShori(); self.postMessage(“finished”, args); break; } }); TDSJQUKT XPSLFSKT