Is canvas getImageData method machine/browser dependent?
问题 A client required help with a program that extracts the dominant color of a product image. I was able to quickly implement this in Javascript; the algorithm below only samples the central square of a 3x3 grid on the image for a quick estimate of the t-shirt color in the image. var image = new Image(); image.onload = function() { try { // get dominant color by sampling the central square of a 3x3 grid on image var dominantColor = getDominantColor(); // output color $("#output").html