Wand rectangle() function in Python Last Updated : 10 May, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report rectangle() function, as the name describes this function is used to draw a circle using wand.drawing object in Python. rectangle takes many arguments like left, top, right, bottom, width, height etc. Syntax : wand.drawing.rectangle(left, top, right, bottom, width, height, radius, xradius, yradius) Parameters : Parameter Input Type Description left numbers.Real x-offset of the rectangle to draw. top numbers.Real y-offset of the rectangle to draw. right numbers.Real second x-offset of the rectangle to draw. this parameter and width parameter are exclusive each other. bottom numbers.Real second y-offset of the rectangle to draw. this parameter and height parameter are exclusive each other. width numbers.Real the width of the rectangle to draw. this parameter and right parameter are exclusive each other. height numbers.Real the height of the rectangle to draw. this parameter and bottom parameter are exclusive each other. radius numbers.Real the corner rounding. this is a short-cut for setting both xradius, and yradius. xradius numbers.Real the xradius corner in horizontal direction.. yradius numbers.Real the yradius corner in vertical direction. Example #1: Python3 1== # Import different modules of wand from wand.image import Image from wand.drawing import Drawing from wand.color import Color import math with Drawing() as draw: draw.fill_color = Color('GREEN') draw.rectangle(left = 25, top = 50, right = 175, bottom = 150) with Image(width = 200, height = 200, background = Color('lightgreen')) as image: draw(image) image.save(filename = "rectangle.png") Output: Example #2: setting corner-radius for the rectangle. Python3 1== # Import different modules of wand from wand.image import Image from wand.drawing import Drawing from wand.color import Color import math with Drawing() as draw: draw.fill_color = Color('GREEN') draw.rectangle(left = 25, top = 50, right = 175, bottom = 150, radius = 25) with Image(width = 200, height = 200, background = Color('lightgreen')) as image: draw(image) image.save(filename = "rectangle.png") Output: Comment More infoAdvertise with us Next Article Wand rectangle() function in Python R RahulSabharwal Follow Improve Article Tags : Python Python-wand Practice Tags : python Similar Reads Wand scale() function - Python The scale() function is an inbuilt function in the Python Wand ImageMagick library which is used to change the image size by scaling each pixel value by given columns and rows. Syntax: scale(columns, rows) Parameters: This function accepts two parameters as mentioned above and defined below: columns 2 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 : Python3 wand.image.sketch( radius, sigma, angle) # radius should always be greater than sig 1 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 subreg 2 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 1 min read Wand spread() function - Python The spread() function is an inbuilt function in the Python Wand ImageMagick library which is used to replace each pixel with the statistic results from neighboring pixel values. The width & height defines the size, or aperture, of the neighboring pixels. Syntax: spread(radius, method) Parameters 2 min read Like