Wand arc() function in Python
Last Updated :
27 Feb, 2023
arc() is a function present in wand.drawing module. arc() function draws an arc in the image. You’ll need to define three pairs of (x, y) coordinates. First & second pair of coordinates will be the minimum bounding rectangle, and the last pair define the starting & ending degree.
Syntax :
wand.drawing.arc(start, end, degree)
Parameters :
Parameter |
Input Type |
Description |
start |
sequence or (numbers.Real, numbers.Real) |
pair which represents starting x and y of the arc. |
end |
sequence or (numbers.Real, numbers.Real) |
pair which represents ending x and y of the arc. |
degree |
sequence or (numbers.Real, numbers.Real) |
pair which represents starting degree, and ending degree |
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' )
draw.arc(( 50 , 50 ),
( 150 , 150 ),
( 135 , - 45 ))
with Image(width = 100 ,
height = 100 ,
background = Color( 'green' )) as img:
draw.draw(img)
img.save(filename = 'arc.png' )
|
Output:
Example #2:
Source Image:
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' )
draw.arc(( 50 , 50 ),
( 150 , 150 ),
( 135 , - 45 ))
with Image(filename = "gog.png" ) as img:
draw.draw(img)
img.save(filename = 'arc.png' )
|
Output:
Share your thoughts in the comments
Please Login to comment...