diff --git a/py/imagefunc.py b/py/imagefunc.py index f9ec0ad..fd43aaf 100644 --- a/py/imagefunc.py +++ b/py/imagefunc.py @@ -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: diff --git a/pyproject.toml b/pyproject.toml index 8714c39..2134adb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui_layerstyle" description = "A set of nodes for ComfyUI it generate image like Adobe Photoshop's Layer Style. the Drop Shadow is first completed node, and follow-up work is in progress." -version = "2.0.32" +version = "2.0.33" license = {text = "MIT License"} dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "scikit_learn", "opencv-contrib-python", "pymatting", "timm", "colour-science", "transformers", "blend_modes", "huggingface_hub", "loguru"]