mymuse / Workflows /image_load_filename.py
Crocody's picture
Upload image_load_filename.py
71a698d verified
Raw
History Blame Contribute Delete
943 Bytes
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)"
}