ColorScale.prototype.vectorToNum = function (vector) { var num = 0; for (var i = 0; i < vector.length; i++) { num += Math.round(vector[i]) * Math.pow(256, vector.length - i - 1); } return num; };
info at phpclasses dot org