diff --git a/img/example.png b/img/example.png index 97a4ffe..6806e9e 100644 Binary files a/img/example.png and b/img/example.png differ diff --git a/pyproject.toml b/pyproject.toml index b8fded9..b49c5a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "ComfyUI_LoadImageWithFileName" -version = "0.0.1" +version = "0.0.2" description = "Load Image With FileName" authors = [ {name = "ComfyUI-LoadImageWithFileName", email = "dgr0725@gmail.com"} diff --git a/src/ComfyUI_LoadImageWithFileName/nodes.py b/src/ComfyUI_LoadImageWithFileName/nodes.py index 2e97b5c..3da536c 100644 --- a/src/ComfyUI_LoadImageWithFileName/nodes.py +++ b/src/ComfyUI_LoadImageWithFileName/nodes.py @@ -21,14 +21,19 @@ class LoadImageWithFileName: ESSENTIALS_CATEGORY = "Basics" SEARCH_ALIASES = ["load image", "open image", "import image", "image input", "upload image", "read image", "image loader"] - RETURN_TYPES = ("IMAGE", "MASK", "STRING", "STRING") - RETURN_NAMES = ("IMAGE", "MASK", "File Name","Path") + RETURN_TYPES = ("IMAGE", "MASK", "STRING", "STRING", "STRING") + RETURN_NAMES = ("IMAGE", "MASK", "File Name", "Extension", "Path") FUNCTION = "load_image_with_file_name" def load_image_with_file_name(self, image): image_path = folder_paths.get_annotated_filepath(image) img = node_helpers.pillow(Image.open, image_path) - img_name = os.path.basename(image_path) + + img_base_name = os.path.basename(image_path) + img_name, img_ext = os.path.splitext(img_base_name) + + img_ext = img_ext.lstrip(".") + img_path = os.path.dirname(image_path) output_images = [] @@ -72,7 +77,7 @@ class LoadImageWithFileName: output_image = output_images[0] output_mask = output_masks[0] - return (output_image, output_mask, img_name, img_path) + return (output_image, output_mask, img_name, img_ext, img_path) @classmethod def IS_CHANGED(s, image):