Spent an hour and a half trying to figure out what we are doing wrong!

It was wrong of us to do int current = x*y*c!
instead it should be
int current = y*width*numComponents + x*numComponents + c

better results but not quite there yet!