Ozballer31
Ozballer31

Reputation: 443

PIL.ImageDraw.arc drawing nothing

PIL.ImageDraw.arc(xy, start, end, fill, width)

xy – Two points to define the bounding box. Sequence of [(x0, y0), (x1, y1)] or [x0, y0, x1, y1], where x1 >= x0 and y1 >= y0.(from docs)

My code

image = Image.new('RGBA', (300, 300), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
x0, y0, x1, y1 = (50, 200, 250, 200)
draw.arc((x0, y0, x1, y1), 0, 180, 'red')
print(x1 >= x0 and y1 >= y0) # -> True

but image is blank

Upvotes: 1

Views: 329

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207425

I think your bounding box is a problem and you want something more akin to this:

image = Image.new('RGBA', (300, 400), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
bbox = (10, 50, 250, 300)
draw.arc(bbox, 0, 180, 'red')

enter image description here

Upvotes: 1

Related Questions