Rotating the image
PIL.Image.Image.rotate() method is used to rotate a given image to the given number of degrees counterclockwise around its center.
Syntax: new_object = PIL.Image.Image.rotate(image_object, angle, resample=0, expand=0) OR new_object = image_object.rotate(angle, resample=0, expand=0)
Code:
Python3
from PIL import Image # Open image im = Image. open ( "nature.jpg" ) # Show actual Image im.show() # Show rotated Image im = im.rotate( 45 ) im.show() |
Output:
Python Pillow – Working with Images
In this article, we will see how to work with images using Pillow in Python. We will discuss basic operations like creating, saving, rotating images. So let’s get started discussing in detail but first, let’s see how to install pillow.
Installation
To install this package type the below command in the terminal.
pip install pillow
Contact Us