Fixed the code by scaling the i2 matrix to a maximum of 255.