Extensions/comfyui-feroccustomnodes
ComfyUI Extension

comfyui-feroccustomnodes

This repository contains custom nodes for ComfyUI, designed to enhance your workflow with text-based operations, particularly for managing and utilizing descriptive texts.

By Ferocit·Created about a year ago·Updated 18 days ago· 0
Ferocit/comfyui-feroccustomnodes
Nodes4
On cloudLocal install
CategoryFeroc
Stars0
Updated18 days ago
Readme

ComfyUI-Feroc Custom Nodes

This repository contains custom nodes for ComfyUI, designed to enhance your workflow with text-based operations, particularly for managing and utilizing descriptive texts.

Installation

  1. Clone this repository into your ComfyUI/custom_nodes/ directory:
    cd ComfyUI/custom_nodes/
    git clone https://github.com/Ferocit/comfyui-feroccustomnodes.git
    
  2. Restart ComfyUI to load the new nodes.

Nodes Included

1. LoadDescriptionNode (Category: Feroc)

Loads a text file from the descriptions folder inside this plugin's directory. Ideal for managing character descriptions, lore, or any other text snippets you frequently use in your workflows.

Inputs:

  • file_path (Dropdown): A dynamic list of all .txt files found recursively under the descriptions folder, including their subdirectory path (e.g., characters/lyraniel_stormweaver.txt).

Outputs:

  • description_text (STRING): The full content of the selected text file.
  • description_name (STRING): The filename without extension (e.g., lyraniel_stormweaver).

Usage:

Place your .txt files inside ComfyUI/custom_nodes/comfyui-feroccustomnodes/descriptions/. Subdirectories are supported (e.g., descriptions/characters/my_character.txt).

If no .txt files exist yet, the node automatically creates descriptions/examples/example.txt as a placeholder.


2. RandomLineFromText (Category: Feroc)

Selects a random line from one or more text files. Useful for injecting variability into prompts by drawing from a pool of predefined lines.

Inputs:

  • seed (INT): Seed for reproducible random selection. The same seed always produces the same output.
  • file_path_1 to file_path_5 (STRING, Optional): Absolute paths to text files. Up to 5 files can be provided.

Outputs:

  • (STRING): A newline-separated string of randomly selected lines, one from each provided file.

Usage:

Provide the full absolute path to your text files (e.g., /home/user/my_lines.txt). The node reads each file, picks a random non-empty line, and combines them into a single output string. Missing or unreadable files are skipped and logged.


3. MegapixelScale (Category: Feroc)

Scales a width/height pair to a target megapixel count while preserving the aspect ratio. Useful for normalizing arbitrary image dimensions to a consistent pixel budget before generation.

Inputs:

  • width (INT): Original width.
  • height (INT): Original height.
  • megapixels (FLOAT): Target size in megapixels (e.g. 1.0 for ~1,000,000 pixels).

Outputs:

  • width (INT): New width, scaled to match the target megapixel count and rounded to the nearest multiple of 8.
  • height (INT): New height, scaled to match the target megapixel count, preserving the original aspect ratio and rounded to the nearest multiple of 8.

Dimensions are rounded to multiples of 8 for compatibility with diffusion models that require it.


Development

Run tests with:

python -m pytest tests/ -v

Contributing

Feel free to open issues or pull requests if you have suggestions or improvements.