mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-12 21:27:03 +08:00
fix: 🐛 limit loadImage dropdown to supported formats
This commit is contained in:
parent
86c5970ac0
commit
fb0bd6dd31
6
nodes.py
6
nodes.py
@ -9,6 +9,7 @@ import math
|
|||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
import logging
|
import logging
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from PIL import Image, ImageOps, ImageSequence, ImageFile
|
from PIL import Image, ImageOps, ImageSequence, ImageFile
|
||||||
from PIL.PngImagePlugin import PngInfo
|
from PIL.PngImagePlugin import PngInfo
|
||||||
@ -1523,8 +1524,9 @@ class PreviewImage(SaveImage):
|
|||||||
class LoadImage:
|
class LoadImage:
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
input_dir = folder_paths.get_input_directory()
|
input_dir = Path(folder_paths.get_input_directory())
|
||||||
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
|
pillow_formats = {ext.lower() for ext in Image.registered_extensions().keys()}
|
||||||
|
files = sorted([f.name for f in input_dir.iterdir() if f.is_file() and f.suffix.lower() in pillow_formats])
|
||||||
return {"required":
|
return {"required":
|
||||||
{"image": (sorted(files), {"image_upload": True})},
|
{"image": (sorted(files), {"image_upload": True})},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user