MCPcopy Create free account
hub / github.com/openai/plugins / threshold_bbox

Function threshold_bbox

plugins/game-studio/scripts/normalize_sprite_strip.py:57–59  ·  view source on GitHub ↗
(image: Image.Image, alpha_threshold: int)

Source from the content-addressed store, hash-verified

55
56
57def threshold_bbox(image: Image.Image, alpha_threshold: int) -> tuple[int, int, int, int] | None:
58 alpha = image.getchannel("A").point(lambda value: 255 if value > alpha_threshold else 0)
59 return alpha.getbbox()
60
61
62def crop_to_content(image: Image.Image, alpha_threshold: int) -> Image.Image | None:

Callers 1

crop_to_contentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected