flipping image in horizontal direction, vertical direction or in both directions