Wednesday, June 10, 2026
HomeLanguagesWand rotate() function in Python

Wand rotate() function in Python

Rotation changes the orientation of image or it rotates image to a particular angle. rotate() takes a degree which can be 0 to 359. (Actually you can pass 360, 361, or more but it will be the same to 0, 1, or more respectively.).
 

Syntax : 
 

wand.image.rotate(degree, background, reset_coords)

Parameters : 
 

Parameter Input Type Description
degree numbers.Real a degree to rotate. multiples of 360 affect nothing
background wand.color.Color an optional background color. default is transparent.
reset_coords bool optional flag. If set, after the rotation, the coordinate frame will be relocated to the upper-left corner of the new image. By default is True.

Source Image: 
 

Example 1: 
 

Python3




# Import Image from wand.image module
from wand.image import Image
 
with Image(filename ="koala.jpeg") as img:
    with img.clone() as rotated:
        # rotate image using rotate() function
        rotated.rotate(90)
        rotated.save(filename ='transform-rotated-90.jpg')


Output : 
 

Example 2: 
 

Python3




# Import Image from wand.image module
from wand.image import Image
from wand.color import Color
 
with Image(filename ="koala.jpeg") as img:
    with img.clone() as rotated:
        # rotate image using rotate() function
        rotated.rotate(135, background = Color('rgb(229, 221, 112)'))
        rotated.save(filename ='transform-rotated-135.jpg')


Output : 
 

 

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

3 COMMENTS

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6896 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS