Skip to content

Commit

Permalink
fix: 🐛 limit loadImage dropdown to supported formats
Browse files Browse the repository at this point in the history
  • Loading branch information
melMass committed Aug 16, 2024
1 parent 86c5970 commit fb0bd6d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import time
import random
import logging
from pathlib import Path

from PIL import Image, ImageOps, ImageSequence, ImageFile
from PIL.PngImagePlugin import PngInfo
Expand Down Expand Up @@ -1523,8 +1524,9 @@ def INPUT_TYPES(s):
class LoadImage:
@classmethod
def INPUT_TYPES(s):
input_dir = folder_paths.get_input_directory()
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
input_dir = Path(folder_paths.get_input_directory())
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":
{"image": (sorted(files), {"image_upload": True})},
}
Expand Down

0 comments on commit fb0bd6d

Please sign in to comment.