Wand ellipse() function in Python
elippse() function is used to draw an ellipse on the image. Just similar to drawing circle the ellipse() function requires two pairs of point that is, origin and a pair of (x, y) radius of the ellipse. To draw a partial ellipse, provide a pair of starting & ending degrees as the third parameter.
Syntax :
wand.drawing.ellipse(origin, radius, rotation)Parameters :
Parameter Input Type Description origin (collections.abc.Sequence) – (numbers.Real, numbers.Real) pair which represents origin x and y of ellipse. radius (collections.abc.Sequence) – (numbers.Real, numbers.Real) pair which represents radius x and radius y of ellipse rotation (collections.abc.Sequence) – (numbers.Real, numbers.Real) pair which represents start and end of ellipse. Default (0, 360)
Example #1:
# Import required objects from wand modulesfrom wand.image import Imagefrom wand.drawing import Drawingfrom wand.color import Color # generate object for wand.drawingwith Drawing() as draw: # set stroke color draw.stroke_color = Color('black') # set width for stroke draw.stroke_width = 1 # fill white color in arc draw.fill_color = Color('white') origin = (100, 100) perimeter = (50, 100) # draw circle using circle() function draw.ellipse(origin, perimeter) with Image(width = 200, height = 200, background = Color('green')) as img: # draw shape on image using draw() function draw.draw(img) img.save(filename ='ellipse.png') |
Output :
Example #2: Drawing partial ellipse using rotation argument
# Import required objects from wand modulesfrom wand.image import Imagefrom wand.drawing import Drawingfrom wand.color import Color # generate object for wand.drawingwith Drawing() as draw: # set stroke color draw.stroke_color = Color('black') # set width for stroke draw.stroke_width = 1 # fill white color in arc draw.fill_color = Color('white') origin = (100, 100) perimeter = (100, 50) rotation = (0, 270) # draw circle using circle() function draw.ellipse(origin, perimeter, rotation) with Image(width = 200, height = 200, background = Color('green')) as img: # draw shape on image using draw() function draw.draw(img) img.save(filename ='ellipsepartial.png') |
Output :
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course


