Image brightness detection in client side script
This function will convert each color to gray scale and return average of all pixels, so final value will be between 0 (darkest) and 255 (brightest) function getImageLightness(imageSrc,callback) { var img = document.createElement(“img”); img.src = imageSrc; img.style.display = “none”; document.body.appendChild(img); var colorSum = 0; img.onload = function() { // create canvas var canvas = document.createElement(“canvas”); … Read more