9951 explained code solutions for 126 technologies


python-pillowHow to rotate image without cropping


from PIL import Image, ImageEnhance

im = Image.open('/var/www/examples/heroine.png')
im = im.rotate(90, expand=True)

im.show()ctrl + c
PIL

import Pillow package modules

Image.open

open given image with Pillow

.rotate(

rotate given image

expand=True

increase image size instead of cropping while rotating

.show()

displays resulting image