You flip your image dimensions after creating the new image.
Try moving GaryImage *n_array = new GrayImage(o_width, o_height);
after switch (rotation) {...}
to use the correct height and width.
Edit: it should be GrayImage *n_array = new GrayImage(n_width, n_height);
anyway