added functionality to flip images in both x and y axis