from PIL import Image import PIL.ImageOps import random from random import randrange #Random number rotation = randrange(20) #Random positive or negative choice = random.choice(("+", "-")) finalnumber = (str(choice) + str(rotation)) rotationinput = int(finalnumber) #open both the watermark logo = Image.open('watermark.png') #rotate the watermark rotatedlogo = logo.rotate(rotationinput, expand=True) rotatedlogo.save('rotated.png')