Wand polygon() function in Python Last Updated : 10 May, 2020 Improve Improve Like Article Like Save Share Report polygon() function is another drawing function introduced in wand.drawing module. We can draw complex shapes using polygon() function. It takes a list of points in polygons as argument. Stroke line will automatically close between first & last point. Syntax : wand.drawing.polygon(points) Parameters : Parameter Input Type Description points list list of x, y tuples. Example #1 from wand.image import Image from wand.drawing import Drawing from wand.color import Color with Drawing() as draw: draw.stroke_width = 2 draw.stroke_color = Color('black') draw.fill_color = Color('white') # points list for polygon points = [(25, 25), (175, 100), (25, 175)] # draw polygon using polygon() function draw.polygon(points) with Image(width = 200, height = 200, background = Color('lightgreen')) as image: draw(image) image.save(filename = "polygon.png") Output : Example #2: from wand.image import Image from wand.drawing import Drawing from wand.color import Color with Drawing() as draw: draw.stroke_width = 2 draw.stroke_color = Color('black') draw.fill_color = Color('white') # points list for polygon points = [(50, 50), (150, 50), (175, 150), (25, 150)] # draw polygon using polygon() function draw.polygon(points) with Image(width = 200, height = 200, background = Color('lightgreen')) as image: draw(image) image.save(filename = "polygon2.png") Output : Like Article Suggest improvement Previous Python - charcoal() method in Wand Next Wand polyline() function in Python Share your thoughts in the comments Add Your Comment Please Login to comment... Similar Reads Wand selective_blur() function in Wand python Wand function() function in Python Wand image - Baseimage.kuwahara() function in Python Wand image.edge function in Python Wand gaussian_blur() function in Python Wand transform() function in Python Wand crop() function in Python Wand rotational_blur() function in Python Wand - blur() function in Python Python - Image() function in Wand Like R RahulSabharwal Follow Article Tags : Python-wand Python Practice Tags : python