I needed to transform a Bitmap into Color [] [] to apply some algorithms and I need to recreate the bitmap. Is there an easy way to do this?
To transform the bitmap into Color [] [] I did what is below. Is it an easier way?
public Color[][] GetPixels(Bitmap b1)
{
int hight = b1.Height;
int width = b1.Width;
Color[][] colorMatrix = new Color[width][];
for (int i = 0; i < width; i++)
{
colorMatrix[i] = new Color[hight];
for (int j = 0; j < hight; j++)
{
colorMatrix[i][j] = b1.GetPixel(i, j);
}
}
return colorMatrix;
}