Is Ii your 256x256x3 array? An image of 256x256 pixels will have 256x256x3 elements because of the red, green and blue elements.
To remove that third dimension, you could extract only one of the layers;
You could average over the layers;
These options will result in Ii having size 256x256, removing the third dimension, but will also remove information that may be useful.