Something like the example below might be found helpful for what you want to accomplish.
function getAverageColourAsRGB(img) {
var canvas = document.createElement('canvas'),
context = canvas.getContext && canvas.getContext('2d'),
rgb = {
r: 102,
g: 102,
b: 102
},
pixelInterval = 5,
count = 0,
i = -4,
data, length;
…
Top comments (0)