Pygame – Flip the image
In this article, we are going to see how images can be flipped using Pygame.
To flip the image we need to use pygame.transform.flip(Surface, xbool, ybool) method which is called to flip the image in vertical direction or horizontal direction according to our needs.
pygame.transform.flip(Surface, xbool, ybool)
Flip the image in vertical direction
In this, we have to flip the image in a vertical direction. We will use pygame.transform.flip() to display the image in vertical. Pass xbool as True and ybool as False, so that the image is flipped vertically.
Flip the image in horizontal direction
In this we have to flip the image in horizontal direction. For this xbool is passed as False and ybool as True, to flip it horizontally.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course