MCPcopy Create free account
hub / github.com/Lightricks/ComfyUI-LTXVideo / tensor_to_pil

Function tensor_to_pil

gemma_encoder.py:43–48  ·  view source on GitHub ↗

Convert ComfyUI image tensor to PIL Image.

(tensor: torch.Tensor)

Source from the content-addressed store, hash-verified

41
42
43def tensor_to_pil(tensor: torch.Tensor) -> Image.Image:
44 """Convert ComfyUI image tensor to PIL Image."""
45 if tensor.dim() == 4:
46 tensor = tensor[0]
47 numpy_image = (tensor.cpu().numpy() * 255).astype("uint8")
48 return Image.fromarray(numpy_image)
49
50
51class LTXVGemmaTokenizer:

Callers 1

enhanceMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected