Friday, September 5, 2025
HomeLanguagesWand circle() function in Python

Wand circle() function in Python

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




# Import required objects from wand modules
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
 
# generate object for wand.drawing
with 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, 50)
 
    # draw circle using circle() function
    draw.circle(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 ='circle.png')


Output:

  

Example #2: 
Input Image:

 

Python3




# Import required objects from wand modules
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
 
# generate object for wand.drawing
with Drawing() as draw:
    origin = (100, 100)
    perimeter = (50, 50)
 
    # 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')
 
    # draw circle using circle function
    draw.circle(origin, perimeter)
    with Image(filename ="gog.png") as img:
 
        # draw shape on image using draw() function
        draw.draw(img)
        img.save(filename ='circle2.png')


Output:

 

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6634 POSTS0 COMMENTS
Nicole Veronica
11801 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11860 POSTS0 COMMENTS
Shaida Kate Naidoo
6749 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6698 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS