pygame copy image, then rotate it

I have one picture which I want to use multiple times on the screen but it always has to be rotated differently. If I use the pygame.image.rotate function it rotates the imported image so I can't rotate every image on its own. Is there any way I can copy it in the code and then rotate it?

> image = pygame.image.load("assets/image")  
pygame.transform.rotate(image, 20) #rotated by 20 deg  
pygame.transform.rotate(image, 20) #rotated by 20  + 20 deg  
#what i want  
copy(pygame.transform.rotate(image, 20))

Solution 1:

pygame.transform.rotate does not rotate the image itself. This function creates a rotated copy of the image and returns the copy:

image = pygame.image.load("assets/image") 
rotated_image_copy = pygame.transform.rotate(image, 20) 

If you want to create multiple rotated images, you must always rotate the original image. See also How do I rotate an image around its center using PyGame?.

Create a list of images:

image = pygame.image.load("assets/image")
image_list = [pygame.transform.rotate(image, ang) for ang in range(0, 360, 20)]