I'm currently looping through a canvas element's imageData pixel array. I want to loop through the first (top) row and the last (bottom) row of pixels. How do I do this?
This is how i'm looping through the entire pixel array:
//Var declarations, etc.
imageData = context.getImageData(0, 0, cols, rows);
for (var i = 0, max = imageData.data.length; i < max; i+=4) {
//This is looping through the entire array.
}