public static byte[,] Assemble(byte[] arr, int width, int height) { byte[,] result = new byte[width,height]; for(int y = 0; y < width; y++) for(int x = 0; x < height; x++) { result[x,y] = arr[y*width+x]; } return result; }