# Rotate the image

Workshop Resources

Now that we have the image in our code, let’s turn it in different directions. To do that, let’s look at the Pillow Image function rotate().

The rotate image works using angles. For example, rotate(45) will tilt your picture sideways by 45 degrees. Using rotate(90) will turn your picture sideways.

Let’s give that a try! Let’s rotate the image before we save it:

image = Image.open("cat.jpg")
image.rotate(90)
image.save("myCat.jpg")


Hmm, the picture didn’t seem to rotate. Why? Well, the image we opened is saved in the image variable. When we rotate the picture, we don’t save the rotated picture in any variable, so our code doesn’t save the rotated image.

image = Image.open("cat.jpg")