MCPcopy Create free account
hub / github.com/PowerHouseMan/ComfyUI-AdvancedLivePortrait / tensor2pil

Function tensor2pil

nodes.py:44–45  ·  view source on GitHub ↗
(image)

Source from the content-addressed store, hash-verified

42 return cur_device
43
44def tensor2pil(image):
45 return Image.fromarray(np.clip(255. * image.cpu().numpy().squeeze(), 0, 255).astype(np.uint8))
46def pil2tensor(image):
47 return torch.from_numpy(np.array(image).astype(np.float32) / 255.0).unsqueeze(0)
48def rgb_crop(rgb, region):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected