var data = Array.prototype.slice.call(imgdata.data, 8);
var output = [];
//Stores these for performance reasons. Shaves 100ms!!!
var push = output.push;
var splice = data.splice;
var removed = 0;
while(data.length && (removed < length))
{
push.apply(output, splice.call(data, 0, 3));
data.shift();
removed += 3;
}
//Removes unnecessary data
output.length = length;