'PIL arc position on Oled Display

I am busy with something witch is not so familiar to me. Trying to design a small logo to be displayed on a Oled display sh1106, 128x64 I am using PIL and Luma libraries.

I am battling to position a small arc in the right position. enter image description here

that small little arc in the yellow circle should be positioned where the arrow is pointing. This is the code I am using for the arc:

shape = [(32, 32), (36,36)]
draw.arc(shape, start = 160, end = 20, fill ="white")

As soon as I change any of the parameters in those two lines above, the shape, size of the arc changes. Even the position changes, but I assume is because of the size change. Thats not I won't. Is there any other parameter which I am missing to position the arc in the right place?



Solution 1:[1]

Hopefully this little example will show you how it works. The bbox specifies the top-left and bottom-right corners of the bounding box that encloses the arc. I have drawn in the bounding box of each arc in the same colour:

#!/usr/bin/env python3

from PIL import Image, ImageDraw

# Create black image and get drawing context
im   = Image.new("RGB", (200, 100))
draw = ImageDraw.Draw(im)

# Draw white arc with bbox
bbox = [(10, 20), (80, 60)]
draw.arc(bbox, start=180, end=360, fill='white')
draw.rectangle(bbox, outline='white')

# Draw red arc with bbox
bbox = [(60, 30), (190, 90)]
draw.arc(bbox, start=180, end=360, fill='red')
draw.rectangle(bbox, outline='red')

# Save result
im.save('result.png')

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mark Setchell