Open In App

Wand rotate() function – Python

Last Updated : 18 Aug, 2021
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

The rotate() function is an inbuilt function in the Python Wand ImageMagick library which is used to rotates the image right. It takes a background color for which rotation is not available.
 

Syntax: 
 

rotate(degree, background, reset_coords)

Parameters: This function accepts three parameters as mentioned above and defined below: 
 

  • degree: This parameter stores the degree of rotation.
  • background: This parameter stores the background color for the portion which has no rotation portion available..
  • reset_coords: This is a boolean parameter which states after the rotation, the coordinate frame will be relocated to the upper-left corner of the new image. By default is True.

Return Value: This function returns the Wand ImageMagick object.

Original Image: 
 

Example 1: 
 

Python3




# Import library from Image
from wand.image import Image
 
# Import the image
with Image(filename ='../geeksforgeeks.png') as image:
    # Clone the image in order to process
    with image.clone() as rotate:
        # Invoke rotate function
        rotate.rotate(45, 'red', True)
        # Save the image
        rotate.save(filename ='rotate1.jpg')


Output: 
 

Example 2: 
 

Python3




# Import libraries from the wand 
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
 
with Drawing() as draw:
    # Set Stroke color the circle to black
    draw.stroke_color = Color('black')
    # Set Width of the circle to 2
    draw.stroke_width = 1
    # Set the fill color to 'White (# FFFFFF)'
    draw.fill_color = Color('white')
 
    # Invoke Circle function with center at 50, 50 and radius 25
    draw.circle((200, 200), # Center point
                (100, 100)) # Perimeter point
    # Set the font style
    draw.font = '../Helvetica.ttf'
    # Set the font size
    draw.font_size = 30
     
    with Image(width = 400, height = 400, background = Color('# 45ff33')) as pic:
        # Set the text and its location
        draw.text(int(pic.width / 3), int(pic.height / 2), 'GeeksForGeeks !')
        # Draw the picture
        draw(pic)
        # Invoke rotate function method
        pic.rotate(50, 'Green', False)
        # Save the image
        pic.save(filename ='rotate2.jpg')


Output: 
 

 



Next Article

Similar Reads

Wand selective_blur() function in Wand python
Another kind of Blur that can be performed using Wand library in python is Selective Blur. Selective blur is similar to normal blur. Difference is that it only effect the part of the image that have contrast below a given quantum threshold. A new attribute named as threshold is introduced in this function. Syntax : C/C++ Code wand.image.selective_b
2 min read
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 : ParameterInput TypeDescriptiondegreenumbers.Re
1 min read
Rotate a picture using ndimage.rotate Scipy
Prerequisites: Mathplotlib, Scipy Some of the most common tasks in image processing are displaying images, Basic manipulations, Image filtering, Image segmentation. In this article, we will use a SciPy module "ndimage.rotate()" to rotate. The SciPy ndimage submodule is dedicated to image processing. Here, ndimage means an n-dimensional image. Appro
2 min read
Wand function() function in Python
function() function is similar to evaluate function. In function() function pixel channels can be manipulated by applies a multi-argument function to pixel channels. Following are the list of FUNCTION_TYPES in Wand: 'undefined''arcsin''arctan''polynomial''sinusoid' Syntax : wand.image.function(function, arguments, channel) Parameters : ParameterInp
1 min read
Wand image - Baseimage.kuwahara() function in Python
Kuwahara is one of the most famous and important effect in image processing. kuwahara() function is used to add kuwahara effect to the image. The kuwahara() method applies a smoothing filter to reduce noise in an image, but also preserves edges. kuwahara() function takes only two parameters. Syntax : wand.image.kuwahara(radius=radius, sigma= std.de
1 min read
Wand image.edge function in Python
Edge Extraction is an effect after which the edges present in image gets highlighted. It is done in order to detect all the edges present in image. edge() function highlight edges on black and white images with a simple convolution filter. Generally, Edge Detection is used by Computer Vision and Machine Learning. Syntax : wand.image.edge(radius=rad
1 min read
Wand gaussian_blur() function in Python
Another type of blur is Gaussian Blur. Difference of Gaussian blur with normal is that Gaussian Blur is achieved by using Gaussian Function. Simply any equation of the form : is called Gaussian Function. Syntax : C/C++ Code wand.image.gaussian_blur(radius="radius_value", sigma="sigma_value", channel = "o
2 min read
Wand transform() function in Python
In order to resize and crop an image at the same time transform() function is used in wand. First crop operation is performed and then resize operation. Syntax : wand.image.transform(crop='', resize='') Parameters : Parameter Input Type Description crop basestring A geometry string defining a subregion of the image to crop to resize basestring A ge
2 min read
Wand crop() function in Python
Cropping an image refers to select an area of image and discard everything outside the cropped area. Crop tool is an important tool as it allows us to get the only relevant part of an image. Also sometimes something unwanted may be contained in the image and that can be discarded from the image using Crop tool.Image Cropping can be performed using
2 min read
Wand rotational_blur() function in Python
Another type of Blur that can be performed in Wand python library is rotational blur. Rotational Blur is quite similar to Motion Blur but in this the motion of blur is circular. rotational_blur() function blur an image in a radius around the center of an image. Unlike the other blur methods, there is no radius or sigma arguments. Syntax : C/C++ Cod
2 min read
Wand - blur() function in Python
Blurring Image means making an image fuzzy or hazy. A blur image is indefinite and it is unable to see an image clearly. Blur is of many types, like - Adaptive blur, Gaussian blur, Selective Blur etc. In order to blur an image we use blur() function. blur() function takes three arguments. Example : Syntax : wand.image.blur(radius="radius_value
2 min read
Python - Image() function in Wand
In this specific article we will learn how to read our image through Python wand module. To read image in Wand we use Image() function. To manipulate an image first of all we need to read image in Python. Parameters : Parameter Input Type Description image Image make exact copy of image blob bytes opens an image of blob byte array file object opens
2 min read
Python - clone() function in wand library
clone() function makes an exact copy of the original image. One can use this clone image to manipulate without affecting the original image. clone() is one of the most important function because it helps in safe manipulation of image. For example, If you get an image and you mess up with the original file, this may leads to a huge loss to a person.
1 min read
Python - shade() function in Wand
shade() function generates a 3d kind of image or creates a 3d effect by simulating a light from an elevated angle. azimuth parameter is used to control the X and Y angle and elevation parameter is used to control the z angle of the image. We can also get final image in grayscale by putting gray parameter as true. Syntax : wand.image.shade(gray, azi
1 min read
Python - sharpen() function in Wand
sharpen() function is used in order to enhance blurry edges into more distinct(sharp) edges. This is achieved using a Gaussian function. The radius value should always less than the standard deviation(sigma). Sharpen effect image more clearer and defined. Syntax : wand.image.sharpen(radius, sigma, channel) Parameters : Parameter Input Type Descript
1 min read
Wand adaptive_sharpen() function in Python
Adaptive Sharpen is similar to normal sharpening but the only difference is sharpen the image more intensely around the pixels with detectable edges, and less intensely away from the edges. Hence output image is more defined and clearer than normal sharpen. Syntax : wand.image.adaptive_sharpen(radius, sigma, channel) Parameters : Parameter Input Ty
1 min read
Python - noise() function in Wand
Image noise is random variation of brightness or color information in images, and is usually an aspect of electronic noise. We can add noise to the image using noise() function. noise function can be useful when applied before a blur operation to defuse an image. Following are the noise we can add using noise() function: gaussianimpulselaplacianmul
1 min read
Python - blue_shift() function in Wand
Blue shift effect make the colors dull by shifting blue values by a factor. A nighttime kind of scene is generated using this. This takes only one parameter factor. A lot of photo editors use this effect to give a night exposure effect to the image. Syntax : wand.image.blue_shift(factor) Parameters : Parameter Input Type Description factor numbers.
1 min read
Python - color_matrix() function in Wand
color_matrix() method allows you to recalculate color values by applying a matrix transform. A matrix can be up to a 6x6 grid where each column maps to a color channel to reference, and each row represents a color channel to effect.red, green, blue, n/a, alpha, and a constant (a.k.a offset) describe the corresponding rows and columns. Syntax : wand
1 min read
Wand unsharp_mask() function - Python
unsharp_mask() is similar to normal sharpen() method in python Wand, but it gives control to blend between filter and original(amount parameter), and the threshold. When the amount value is greater than 1.0 more if the sharpen filter is applied, and less if the value is under 1.0. Values for threshold over 0.0 reduce the sharpens. Syntax : C/C++ Co
2 min read
Wand colorize() function - Python
Colorized Image refers to image that is blended with a particular color. In order to generate a colorized image we use colorize() function in python Wand. colorize() function blends an image with a constant color. It takes two parameters color and alpha. Syntax : wand.image.colorize(color, alpha) Parameters : Parameter Input Type Description color
1 min read
Wand fx() function - Python
FX special effects are a powerful “micro” language to work with. Simple functions & operators offer a unique way to access & manipulate image data. The fx() method applies a FX expression, and generates a new Image instance. We can create a custom DIY filter that will turn the image black & white, except colors with a hue above 324°, or
1 min read
Wand implode() function - Python
implode() generates a kind of distorted image in which pull effect is noticed into the middle of the image. The amount argument controls the range of pixels to pull towards the center. Syntax : wand.image.implode(amount, method) Parameters : ParameterInput TypeDescriptionamountnumbers.RealNormalized degree of effect between 0.0 & 1.0./td>met
1 min read
Wand polaroid() function - Python
polaroid() is one of function with simplest functionality. It generates image with a white border with a slight shadow to create a special effect of a Polaroid print. Syntax : wand.image.polaroid(angle, caption, font, method) Parameters : Parameter Input Type Description angle numbers.Real applies a shadow effect along this angle. caption basestrin
1 min read
Wand sepia_tone() function - Python
sepia_tone() simulate old style silver based chemical photography printing. sepia_tone() function apply sepia toning to images. Syntax : wand.image.sepia_tone(threshold) Parameters : Parameter Input Type Description threshold numbers.Real The extent of the toning. Value can be between 0 & quantum_range, or 0 & 1.0. Default value is 0.8 or “
1 min read
Wand - sketch() function in Python
Sketch is another artistic special effect present in Wand library in python. sketch() function generates a pencil sketched image in output.For best results, radius value should be larger than sigma. Syntax : C/C++ Code wand.image.sketch( radius, sigma, angle) # radius should always be greater than sigma(standard deviation) Parameter : ParameterInpu
1 min read
Wand solarize() function in Python
Solarize Effect is the effect of tone reversal observed in cases of extreme overexposure of the photographic film in the camera. Most likely, the effect was first observed in scenery photographs including the sun (e.q. sol, sun). The sun, instead of being the whitest spot in the image, turned black or grey. solarize() function creates a “burned” ef
1 min read
Wand stereogram() function in Python
Stereogram Effect is the effect that generates image inside image. A stereogram is a picture within a picture. Hidden inside each image is an object which appears in 3D when viewed correctly. stereogram() function takes two Image instances (one for each eye), and creates a 3d image by separating the Red & Cyan. Syntax : wand.image.stereogram(le
1 min read
Wand swirl() function in Python
swirl() generates a kind of distorted image in which a visual whirlpool effect by rotating pixels around the center of the image.implode() generates a kind of distorted image in which pull effect is noticed into the middle of the image.The amount argument controls the range of pixels to pull towards the center. Syntax : wand.image.swirl(degree, met
1 min read
Wand tint() function in Python
tint() function colorizes midtones of an image by blending the given color. The alpha parameter controls how the blend is effected between color channels. However, this can be tricky to use, so when in doubt, use a alpha="gray(50)" argument. Syntax : wand.image.tint(color, alpha) Parameters : ParameterInput TypeDescriptioncolorColorColor to calcula
1 min read
Practice Tags :
  翻译: