comfyanonymous / ComfyUI

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
https://www.comfy.org/
GNU General Public License v3.0
52.09k stars 5.48k forks source link

Support loading images from arbitrary paths #138

Open jamesWalker55 opened 1 year ago

jamesWalker55 commented 1 year ago

Currently, the LoadImage node only uses images in the .\input\ folder. When using the API, I have to copy the image(s) I want to use into that folder before calling the API.

I would like to request the ability to supply the API with arbitrary filesystem paths, like D:/Files/001.png. Here is an example prompt:

{
    "3": {
      "inputs": {
        "seed": 272520401961745,
        "steps": 20,
        "cfg": 8.0,
        "sampler_name": "dpmpp_2m",
        "scheduler": "karras",
        "denoise": 0.6,
        "model": ["4", 0],
        "positive": ["49", 0],
        "negative": ["46", 0],
        "latent_image": ["38", 0]
      },
      "class_type": "KSampler"
    },
    "4": {
      "inputs": {
        "config_name": "v1-inference_clip_skip_2.yaml",
        "ckpt_name": "Anything-V3.0-pruned-fp16.ckpt"
      },
      "class_type": "CheckpointLoader"
    },
    "8": {
      "inputs": { "samples": ["3", 0], "vae": ["4", 2] },
      "class_type": "VAEDecode"
    },
    "9": {
      "inputs": { "filename_prefix": "ComfyUI", "images": ["8", 0] },
      "class_type": "SaveImage"
    },
    "20": {
      "inputs": { "image": "D:/sd/raw-hed.png", "choose file to upload": "image" },
      "class_type": "LoadImage",
      "is_changed": "ad56109807a198023d5ec961aa415787b5fabb9a37d2102df55b81ac5a06420d"
    },
    "24": {
      "inputs": {
        "text": "masterpiece, best quality, 1girl,",
        "clip": ["4", 1]
      },
      "class_type": "CLIPTextEncode"
    },
    "37": {
      "inputs": { "image": "D:/sd/raw-img2img.png", "choose file to upload": "image" },
      "class_type": "LoadImage",
      "is_changed": "045a75c45c361f22deb650a298a776210cfee88f62030785eece5728f605213b"
    },
    "38": {
      "inputs": { "pixels": ["37", 0], "vae": ["4", 2] },
      "class_type": "VAEEncode"
    },
    "46": {
      "inputs": {
        "text": "embedding:EasyNegative, embedding:bad-artist, embedding:bad-hands-5, (hands), ",
        "clip": ["4", 1]
      },
      "class_type": "CLIPTextEncode"
    },
    "49": {
      "inputs": {
        "strength": 1.0,
        "conditioning": ["24", 0],
        "control_net": ["50", 0],
        "image": ["20", 0]
      },
      "class_type": "ControlNetApply"
    },
    "50": {
      "inputs": {
        "control_net_name": "diff_control_sd15_hed_fp16.safetensors",
        "model": ["4", 0]
      },
      "class_type": "DiffControlNetLoader"
    }
  }
space-nuko commented 1 year ago

Or at least a way to specify which ComfyUI folder that LoadImage will choose images from, input temp or output. Useful if you want an HR fix workflow that acts on existing outputs.

Chaoses-Ib commented 1 year ago

I made a custom node for this: https://github.com/Chaoses-Ib/ComfyUI_Ib_CustomNodes

rethink-studios commented 1 year ago

+1

rhdunn commented 2 months ago

The same issue applies to LoadAudio.

It would be helpful to support this as it is common to have various datasets checked out or stored on the machine which can often be very large. This makes it slow to work with.

It would be nice to specify the directory to search (default_dir) and have the UI list the files in that directory so you can choose the file in that list. And have a way to refresh the list without having to reload the UI.