fix bug of converting BF16 tensor to pillow image

This commit is contained in:
chflame163
2025-12-29 15:52:17 +08:00
parent dc3ffd8953
commit 86cc56bbcf
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -137,7 +137,15 @@ def tensor2np(tensor: torch.Tensor) -> List[np.ndarray]:
return [np.clip(255.0 * t.cpu().numpy(), 0, 255).astype(np.uint8) for t in tensor]
def tensor2pil(t_image: torch.Tensor) -> Image:
return Image.fromarray(np.clip(255.0 * t_image.cpu().numpy().squeeze(), 0, 255).astype(np.uint8))
if t_image.dtype != torch.float32:
t_image = t_image.float()
return Image.fromarray(
np.clip(
255.0 * t_image.cpu().numpy().squeeze(),
0,
255
).astype(np.uint8)
)
def tensor2cv2(image:torch.Tensor) -> np.array:
if image.dim() == 4:
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "ComfyUI_LayerStyle_Advance"
description = "The nodes detached from ComfyUI Layer Style are mainly those with complex requirements for dependency packages."
version = "2.0.32"
version = "2.0.33"
license = { text = "MIT License" }
dependencies = ["numpy", "matplotlib", "scikit_image", "scikit_learn", "opencv-contrib-python", "pymatting", "timm", "blend_modes", "transformers", "diffusers", "loguru", "colour-science", "huggingface_hub", "segment_anything", "addict", "omegaconf", "yapf", "wget", "iopath", "mediapipe", "typer_config", "fastapi", "rich", "google-generativeai", "ultralytics", "transparent-background", "accelerate", "onnxruntime", "bitsandbytes", "peft", "protobuf", "hydra-core", "blind-watermark", "qrcode", "pyzbar", "psd-tools", "wandb", "zhipuai", "openai","google-genai", "fastapi","typer-config"]