Array index is out of range (38940)

Hey guys i have a problem with my Unity Code…

I want to create an Array to save pixels from a 1024*1024 image.
Because i want to create an 3D Pointcloud out of this image.

Here is the Code:

public class PointCloud : MonoBehaviour
{

public Texture2D inputBitmap;
private Color col;

// Use this for initialization
void Start()
{

    Color[] pixels = inputBitmap.GetPixels(0, 0, 50, 50);
    for (int xcoord = 0; xcoord < inputBitmap.width; xcoord++)
    {
        for (int ycoord = 0; ycoord < inputBitmap.height; ycoord++)
        {
            col = pixels[ycoord * 100 + xcoord];
        }
     }
}

The funny thing is, that it worked till yesterday.
But today i got this error: Array index is out of range.

Any ideas what i can do?

pixels is of size 5050, not 100100. change

col = pixels[ycoord * 100 + xcoord ];

into

col = pixels[ xcoord * inputBitmap.width + ycoord ];