Output incorrect.
The displayed image should be same as the original one.
My image is rotated 90 degrees anticlockwise. Need to figure out why.
The colors are also not correct.
Will now implement the zigzag logic first and then come back to the above issues.