MCPcopy
hub / github.com/microsoft/Magma / get_text_size

Function get_text_size

data/utils/som_tom.py:13–17  ·  view source on GitHub ↗
(text, image, font)

Source from the content-addressed store, hash-verified

11 draw = ImageDraw.Draw(image)
12
13 def get_text_size(text, image, font):
14 im = Image.new('RGB', (image.width, image.height))
15 draw = ImageDraw.Draw(im)
16 _, _, width, height = draw.textbbox((0, 0), text=text, font=font)
17 return width, height
18
19 def expand_bbox(bbox):
20 x1, y1, x2, y2 = bbox

Callers 2

som_promptingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected