![License: AGPL-3.0](https://img.shields.io/badge/license-AGPL--3.0-blue.svg?style=for-the-badge) ![ComfyUI](https://img.shields.io/badge/ComfyUI-custom__node-orange.svg?style=for-the-badge) ![Python](https://img.shields.io/badge/python-3.10%2B-3776ab.svg?style=for-the-badge)
# TTools for ComfyUI **A tiny, sharp set of custom ComfyUI nodes for prompt wrangling and SD3-friendly resolutions — stop-word-aware text randomization, JSON extraction from messy strings, and 1-megapixel resolution solving.** > **Why should I care?** Prompt pipelines rot at the edges: LLM chatter stuck around your JSON, stop-words mangled by naive randomization, and SD3 latents that want dimensions near 1 MP in multiples of 64. TTools is the three-node toolbox that fixes all three — drop it in `custom_nodes/` and get cleaner prompts and pixel-safe resolutions. ## Features - **📝 Text randomization & formatting** — spaCy-powered (`en_core_web_sm`) stop-word handling with a curated keep-list, so randomization respects the words that matter - **🧩 JSON extraction** — pulls JSON objects out of messy strings, randomizes the extracted values, emits a comma-separated result - **📐 SD3 Resolution Solver** — computes width/height near 1 megapixel, snapped to multiples of 64, with Portrait/Landscape orientation and a configurable long-side cap ## Node map ```mermaid flowchart LR subgraph TTools A["TTools Extract JSON"] B["TTools SD3 Resolution Solver"] end P[Prompt text] --> A A --> C[Comma-separated values] X[x, y] --> B B --> W[Width] B --> H[Height] ``` | Node | What it does | |---|---| | `TTools Extract JSON` | Extracts JSON from a string, randomizes values, outputs comma-separated text | | `TTools SD3 Resolution Solver` | Scales (x, y) toward ~1 MP, rounds to multiples of 64, enforces orientation + `max_long_side` | ## Quick start ```bash cd /ComfyUI/custom_nodes/ git clone https://github.com/toxicwind/ComfyUI-TTools.git pip install -r ComfyUI-TTools/requirements.txt ``` Restart ComfyUI — the nodes appear under the `utils` category. ## Config | Input | Default | Notes | |---|---|---| | `x`, `y` | 1024, 1024 | Source resolution | | `max_long_side` | 1280 | Clamps the long edge after scaling | | `format` | Portrait | `Portrait` or `Landscape` | | `skip_if_mulof64` | false | Pass through when already 64-aligned | The stop-word keep-list lives at the top of `__init__.py` (`remove_stop_word_tokens`); the phrase-replacement list is `words_to_replace.txt`. ## Dev / contributing This is a single-file node pack — `__init__.py` is the whole implementation. PRs welcome: fork, branch, open a pull request against `main`. ## License + security Licensed under the **GNU Affero General Public License v3.0** — see [LICENSE.txt](LICENSE.txt). If you run a modified version as a network service, the AGPL requires you to share the source. Security: this node pack executes inside your ComfyUI process with full Python access — install only from sources you trust, and review `__init__.py` before adding any custom node to a production workflow.