Skip to content

Instantly share code, notes, and snippets.

View TheoElia's full-sized avatar

Theophilus Nutifafa TheoElia

View GitHub Profile
@dctalbot
dctalbot / get_color.js
Created June 26, 2019 20:26
Get Common or "Dominant" Color from Image
drawImage = async img_path => {
let canvas = document.createElement("canvas");
canvas.src = img_path;
const context = canvas.getContext("2d");
const img = await loadImage(img_path);
canvas.width = img.width;
canvas.height = img.height;
context.drawImage(img, 0, 0);