MCPcopy Create free account
hub / github.com/cifertech/DisplayKit / load_rgba_resized

Function load_rgba_resized

server/icon_export.py:90–99  ·  view source on GitHub ↗
(path: Path, tw: int, th: int)

Source from the content-addressed store, hash-verified

88
89
90def load_rgba_resized(path: Path, tw: int, th: int) -> tuple[int, int, bytes]:
91 with Image.open(path) as im:
92 im = im.convert("RGBA")
93 nw, nh = im.size
94 if tw <= 0 or th <= 0:
95 raise ValueError("Invalid icon dimensions.")
96 if (nw, nh) != (tw, th):
97 im = im.resize((tw, th), Image.Resampling.LANCZOS)
98 raw = im.tobytes()
99 return tw, th, raw
100
101
102class IconRef(BaseModel):

Callers 1

export_iconsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected