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

Function bool_from_mode

server/tft_gif_core.py:60–74  ·  view source on GitHub ↗
(value: str | bool, frame: Image.Image)

Source from the content-addressed store, hash-verified

58
59
60def bool_from_mode(value: str | bool, frame: Image.Image) -> bool:
61 if isinstance(value, bool):
62 return value
63 mode = value.lower()
64 if mode == "true":
65 return True
66 if mode == "false":
67 return False
68 corners = [
69 frame.getpixel((0, 0)),
70 frame.getpixel((frame.width - 1, 0)),
71 frame.getpixel((0, frame.height - 1)),
72 frame.getpixel((frame.width - 1, frame.height - 1)),
73 ]
74 return (sum(corners) // len(corners)) > 128
75
76
77def load_source_frames(src: Path, settings: ConvertSettings) -> tuple[list[Image.Image], list[int], int]:

Callers 1

convert_frameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected