fix the UIImage orientation (translated to Swift)