[StructLayout(LayoutKind.Sequential)]
public struct PixelColor
{
 public byte Blue;
 public byte Green;
 public byte Red;
 public byte Alpha;
}
public PixelColor[,] GetPixels(BitmapSource source)
{
 if(source.PixelFormat!=PixelFormats.Bgra32)
 source = new FormatConvertedBitmap(source, PixelFormats.Bgra32, null, 0);
 int width = source.PixelWidth;
 int height = source.PixelHeight;
 PixelColor[,] result = new PixelColor[width, height];
 source.CopyPixels(result, width * 4, 0);
 return pixels;
}
I get this error message Input array is not a valid rank. Parameter name: pixels on this line  source.CopyPixels(result, width * 4, 0); 
Does anyone know what the problem is?