MCPcopy Create free account
hub / github.com/Open-Bee/DataStudio / _decode_one

Method _decode_one

datastudio/datasets/data_loader.py:293–301  ·  view source on GitHub ↗

Decode PNG bytes to PIL Image.

(path_and_bytes)

Source from the content-addressed store, hash-verified

291
292 # Step 4: Decode each unique image ONCE (avoid decoding same image N times)
293 def _decode_one(path_and_bytes):
294 """Decode PNG bytes to PIL Image."""
295 path, raw_bytes = path_and_bytes
296 try:
297 img_pil = Image.open(io.BytesIO(raw_bytes))
298 img_pil.load()
299 return path, img_pil
300 except Exception:
301 return path, None
302
303 decode_items = [(p, b) for p, b in img_bytes_map.items() if b is not None]
304 img_pil_map = {}

Callers

nothing calls this directly

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected