added proper image rotation

used in the main file, should make it external later