moved arrays to row,col,rgb instead of rgb,row,col