Nodes/ComfyUI_Local_Media_Manager/Select Original Image
ComfyUI Node

Select Original Image

Grab the exact image out of a multi-select — and the prompt that made it comes along

By Firetheft·Created about a year ago·Updated 9 months ago· 143
Select Original Image
  • paths
  • image
  • width
  • height
  • positive_prompt
  • negative_prompt
index0
frame_load_cap1
generation_width1024
generation_height1024
aspect_ratio_preservation

The Local Media Manager hub hands you a batch of everything you Ctrl+Clicked, normalized to one size. That's great for feeding a whole folder through the same pipeline, but it's useless when you want one specific image - say the third reference shot - at a size that fits your latent. Select Original Image is the unwrap node: you tell it which index in the multi-select you mean, and it returns that image resized to your liking. Bonus: it digs the generation prompt out of the file's embedded metadata, so a reference image can arrive with its own positive and negative prompts attached.

How it works

You wire the gallery's paths output into this node, set index to the sequence number (the one shown on the card when you multi-select - counting starts at 0), and the node parses the selection JSON, finds the image item at that position, and loads it. Resizing is snapped to 8px multiples (VAE-friendly) using the aspect_ratio_preservation mode, then the whole thing gets fed through common_upscale.

The prompt extraction is the clever part. ComfyUI images carry their generation history inside the file as PNG text chunks - the workflow and prompt JSON, or an A1111-style parameters string (the "workflow lives in the file" convention that the whole ecosystem runs on; see the image-io-metadata knowledge doc). This node reads that metadata and, when it's a ComfyUI workflow, actually walks the node graph: it finds CLIPTextEncode nodes that feed a sampler, follows the wires to the text's source, and splits positive from negative by checking whether the node's title contains "negative". It even understands the old A1111 Negative prompt: / Steps: layout. That's real work, and it usually just works - but it can only extract prompts that exist. No metadata, no prompt: you get empty strings, not an error.

The inputs that matter

  • paths - connect this to the gallery node's paths output. Non-negotiable.
  • index - which selected image to use, 0-based. This is the one you'll tweak most.
  • generation_width / generation_height - target size (64–8096, stepped by 8). If aspect_ratio_preservation is original, these are ignored.
  • aspect_ratio_preservation - the four-way resize mode: original (no processing), keep_input (preserve the file's aspect ratio), stretch_to_new (squash to fit), crop_to_new (center-crop to fit). For img2img you usually want keep_input or crop_to_new.
  • frame_load_cap - the author's tooltip says it best: "copy a single image into a specified number of image sequences." Set it above 1 and the one image is repeated into N frames, which is exactly what you want to seed a video pipeline from a still.

What comes out and where it goes

  • image (IMAGE) - the single resized image tensor (or N-frame sequence if you raised frame_load_cap). Wire it into a VAEEncode for img2img, an upscaler's input, or an inpainting setup.
  • width / height (INT) - the actual output dimensions, handy if a downstream node needs them.
  • positive_prompt / negative_prompt (STRING) - the extracted prompts. Feed them into CLIPTextEncode, a text primitive, or a save-metadata node.

Gotchas

  • Index counts only what's in your selection, and only image items at that. If you selected two videos then an image, index 2 is that image; index 0 is the video and returns an empty placeholder (a 1×1 black image).
  • Out-of-range index → same empty placeholder, silently. Nothing crashes, but your pipeline runs on a blank frame, so check the number if output looks off.
  • Prompt quality tracks the source workflow. It's tuned for standard CLIPTextEncode → sampler graphs; exotic nodes or mangled metadata yield blanks. For the modern frontend's Nodes 2.0 graph format the parsing is best-effort.

Install it via ComfyUI Manager (search "Local Media Manager") or git clone https://github.com/Firetheft/ComfyUI_Local_Media_Manager into custom_nodes/, then pip install -r requirements.txt and restart.

Category📜Asset Gallery/Local

Inputs (6)

NameTypeDefaultDescription
pathsLMM_ALL_PATHS
indexINT0
frame_load_capINT11–4096Copy a single image into a specified number of image sequences
generation_widthINT102464–8096The desired image width
generation_heightINT102464–8096The desired image height
aspect_ratio_preservationCOMBOZoom Mode: - keep_input: Maintain the aspect ratio of the original image - stretch_to_new: Stretch to fit the new size - crop_to_new: Cropped to fit new sizes - original: No processing is performed, use the original image size

Outputs (5)

NameTypeDescription
imageIMAGE
widthINT
heightINT
positive_promptSTRING
negative_promptSTRING