To manipulate an image using Python Imaging Library (PIL), you first need to import the Image module from PIL. Then, use the open() function to load your image into memory by providing the path of the image as a string argument. Once loaded, you can rotate the image using the rotate() method which takes degrees as an argument. Finally, display the image using the show() method.
Here’s a code example:
from PIL import Image
# Open an image file
img = Image.open('path_to_your_image.jpg')
# Rotate the image 90 degrees
rotated_img = img.rotate(90)
# Display the rotated image
rotated_img.show()