Wand circle() function in Python (original) (raw)

Last Updated : 25 Apr, 2025

The circle() function is another Drawing function in Wand. This method is used to draw a circle in the image. It requires only two arguments that are origin and perimeter of the circle.

Syntax: wand.drawing.circle(origin, perimeter)

Parameters :

Parameter Input Type Description
origin (collections.abc.Sequence)or(Real, numbers.Real) pair which represents origin x and y of circle.
perimeter (collections.abc.Sequence)or(Real, numbers.Real) pair which represents perimeter x and y of circle

Example #1:

Python3

from wand.image import Image

from wand.drawing import Drawing

from wand.color import Color

with Drawing() as draw:

`` draw.stroke_color = Color( 'black' )

`` draw.stroke_width = 1

`` draw.fill_color = Color( 'white' )

`` origin = ( 100 , 100 )

`` perimeter = ( 50 , 50 )

`` draw.circle(origin, perimeter)

`` with Image(width = 200 ,

`` height = 200 ,

`` background = Color( 'green' )) as img:

`` draw.draw(img)

`` img.save(filename = 'circle.png' )

Output:

Example #2:
Input Image:

Python3

from wand.image import Image

from wand.drawing import Drawing

from wand.color import Color

with Drawing() as draw:

`` origin = ( 100 , 100 )

`` perimeter = ( 50 , 50 )

`` draw.stroke_color = Color( 'black' )

`` draw.stroke_width = 1

`` draw.fill_color = Color( 'white' )

`` draw.circle(origin, perimeter)

`` with Image(filename = "gog.png") as img:

`` draw.draw(img)

`` img.save(filename = 'circle2.png' )

Output:

Similar Reads