How many ways to flatten 3 channels image and reconstruct

Here’s a thread which describes at least 2 correct approaches and one incorrect approach for flattening 3 channel images. But it does not discuss reconstructing the 4D arrays from the flattened arrays.