import os from nodes import LoadImage class DragAndDropLoadImageWithFilename(LoadImage): @classmethod def INPUT_TYPES(s): return super().INPUT_TYPES() # 이미지 파일명(STRING)을 출력 단자에 추가 RETURN_TYPES = ("IMAGE", "MASK", "STRING") RETURN_NAMES = ("image", "mask", "filename") FUNCTION = "load_image_with_filename" def load_image_with_filename(self, image): # 기존 LoadImage 기능을 그대로 가져와 이미지와 마스크 생성 image_out, mask_out = super().load_image(image) # 이미지 파일명만 추출 (확장자 포함) filename = os.path.basename(image) return (image_out, mask_out, filename) NODE_CLASS_MAPPINGS = { "DragAndDropLoadImageWithFilename": DragAndDropLoadImageWithFilename } NODE_DISPLAY_NAME_MAPPINGS = { "DragAndDropLoadImageWithFilename": "Load Image (Drag&Drop + Filename)" }