Created
May 16, 2018 14:28
-
-
Save andrei-cacio/7dfec242d4821756fc68920c46371d2e to your computer and use it in GitHub Desktop.
The desired output of distil-wasm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function distil(imgPath, nrOfPalettes = 2) { | |
const wasmModule = await compile('distil.wasm'); | |
const { imgBufferLocation, length } = await readImgIntoMemory(imgPath); | |
const paletteBuffer = wasmModule.exports.distil(imgBufferLocation, length); | |
console.log(bufferToHex(paletteBuffer, nrOfPalettes)); | |
} | |
// -> ['#ff1122', '#jjkkll'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment