Crocody commited on
Commit
71a698d
·
verified ·
1 Parent(s): b306361

Upload image_load_filename.py

Browse files
Files changed (1) hide show
  1. Workflows/image_load_filename.py +27 -0
Workflows/image_load_filename.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from nodes import LoadImage
3
+
4
+ class DragAndDropLoadImageWithFilename(LoadImage):
5
+ @classmethod
6
+ def INPUT_TYPES(s):
7
+ return super().INPUT_TYPES()
8
+
9
+ # 이미지 파일명(STRING)을 출력 단자에 추가
10
+ RETURN_TYPES = ("IMAGE", "MASK", "STRING")
11
+ RETURN_NAMES = ("image", "mask", "filename")
12
+ FUNCTION = "load_image_with_filename"
13
+
14
+ def load_image_with_filename(self, image):
15
+ # 기존 LoadImage 기능을 그대로 가져와 이미지와 마스크 생성
16
+ image_out, mask_out = super().load_image(image)
17
+ # 이미지 파일명만 추출 (확장자 포함)
18
+ filename = os.path.basename(image)
19
+ return (image_out, mask_out, filename)
20
+
21
+ NODE_CLASS_MAPPINGS = {
22
+ "DragAndDropLoadImageWithFilename": DragAndDropLoadImageWithFilename
23
+ }
24
+
25
+ NODE_DISPLAY_NAME_MAPPINGS = {
26
+ "DragAndDropLoadImageWithFilename": "Load Image (Drag&Drop + Filename)"
27
+ }