How zml-w/comfyui-zml-image works
1. Repository role
- This is a ComfyUI custom-node extension rather than a standalone app.
- The repo adds a large node family labeled ZML_..., organized under ComfyUI’s image-related category, with 160+ nodes spanning image, text, LoRA, logic, HTTP, LLM, animation, and utility workflows.
2. Top-level package structure
- zml_w/ is the main Python package containing backend node implementations.
- zml_w/web/ contains the browser-side UI layer for custom node editors, previews, and interactive controls.
- workflows/ holds example ComfyUI workflow JSON files that demonstrate how the nodes are connected in practice.
- requirements.txt defines Python dependencies needed by the node package.
3. Backend execution model
- The Python modules in zml_w/ implement the actual ComfyUI node logic and data transformations.
- The module names suggest subsystems by concern:
- zml_image_nodes.py, zml_text_nodes.py, zml_prompt_nodes.py, zml_resolution_nodes.py
- zml_lora_nodes.py, zml_ksampler_nodes.py, zml_llm_nodes.py, zml_http_nodes.py
- zml_logic_nodes.py, zml_parallel_nodes.py, zml_xyz_nodes.py, zml_review_nodes.py
- zml_ps_node.py, zml_novelai_nodes.py, zml_animation_nodes.py
- __init__.py is the package entry point where ComfyUI node registration is typically wired up.
4. Frontend/UI boundary
- The zml_w/web/js/*.js files are the main browser-side boundary for custom interactions.
- These scripts implement node-specific UIs such as:
- interactive image selection and preview
- floating controls / “pause” style nodes
- prompt editors and preset editors
- LoRA loaders with preview, folder browsing, and custom metadata editing
- text nodes with dynamic fields
- The architecture is split so that heavy processing stays in Python, while interactive editing and previews happen in the browser.
5. Main data flow: image-centric graph processing
- Many nodes operate on image tensors, masks, and metadata as they move through the ComfyUI graph.
- A key theme is preserving or extracting prompt information from images:
- save nodes write text blocks / metadata into images
- load nodes recover those text blocks
- path-based loaders read whole folders and can select by index or random choice
- This makes image files act as a transport layer for prompts, tags, and workflow-adjacent annotations.
6. Prompt and text subsystem
- The text-related modules and assets support prompt assembly, formatting, selection, and translation-like utilities.
- Static text libraries live under zml_w/txt/ and zml_w/web/Prompt word/, including tag lists, preset prompt groups, and Chinese/English prompt resources.
- The text subsystem is designed to feed generation workflows, especially prompt-heavy image generation and WAN/SD-style pipelines.
7. LoRA and model-augmentation subsystem
- zml_lora_nodes.py and related UI scripts form one of the core subsystems.
- The repo stores LoRA-adjacent helper material in the file tree indirectly through metadata/preset handling rather than hardcoding model content.
- The loader UI supports:
- hierarchical folders
- hover previews
- bundled TXT/LOG/image metadata
- custom names, weights, and editable notes
- Data flow here is from filesystem model assets → browser UI selection/editing → Python node outputs used by samplers.
8. Sampler / generation orchestration
- zml_ksampler_nodes.py is a distinct generation-control layer around sampling.
- The README indicates it can capture generation parameters, inject extra effects, and coordinate preview behavior.
- This subsystem likely sits between model/conditioning inputs and output image saving, acting as the main execution bridge for generation workflows.
9. Automation and non-image integrations
- zml_http_nodes.py and zml_llm_nodes.py extend the graph beyond local image processing.
- HTTP nodes enable custom request/response flows.
- LLM nodes integrate external model APIs and structured outputs.
- These are notable because they turn the repo into a general workflow tool, not just an image extension.
10. Advanced image tools and editor-like nodes
- Several modules suggest interactive image editing and annotation behavior:
- zml_ps_node.py for Photoshop-like operations
- zml_visual_cropper.py and zml_image_nodes.py for crop/merge/selection workflows
- zml_text_annotation.py for drawing text onto images
- zml_review_nodes.py for inspection/review-style output selection
- These nodes often use browser-side libraries or custom canvases to perform edit-time interactions, then store the result back into the node state.
11. Auxiliary assets and media
- zml_w/web/images/ and zml_w/audio/ contain bundled UI assets and sounds used by notification-style nodes and the floating mascot.
- zml_w/Font/ provides bundled fonts for rendering text on images.
- These assets are part of the UI/runtime experience and directly affect text rendering, previews, and notifications.
12. Workflow examples and operational boundary
- The workflows/*.json files are examples, documentation, and test fixtures for how the nodes are intended to compose.
- The repo’s architecture is centered on ComfyUI graph composition, with state flowing through node outputs rather than through a separate application service.
- Persistent settings may live in workflow JSON, browser-side storage, or local asset folders, depending on the node type.
13. Overall architectural shape
- At a high level, the repo is a two-part ComfyUI extension:
- Python backend nodes for computation, file IO, metadata handling, and external API calls
- JavaScript frontend modules for rich node UIs, previews, editors, and interactive selection
- Supporting content folders provide prompt libraries, fonts, audio, and example workflows so the nodes can be used as a self-contained image/prompt production toolkit.
Main entry points: __init__.py Entry point · zml_image_nodes.py Image nodes · zml_prompt_nodes.py Prompt nodes · Prompt word Web prompts
Components 34
Python nodes
ComfyUI backend node implementations and execution logic.
- Entry point · Registers the extension with ComfyUI and wires node exports.
__init__.py - Image nodes · Core image, mask, crop, merge, and file-centric image utilities.
zml_w/zml_image_nodes.py - Text nodes · Dynamic text handling, formatting, and prompt text transformations.
zml_w/zml_text_nodes.py - Prompt nodes · Prompt assembly, selection, preset-driven prompt generation, and tag workflows.
zml_w/zml_prompt_nodes.py - Resolution nodes · Resolution and sizing helpers for image generation workflows.
zml_w/zml_resolution_nodes.py - LoRA nodes · LoRA loading and augmentation helpers used by generation pipelines.
zml_w/zml_lora_nodes.py - KSampler nodes · Generation control layer around sampling, preview behavior, and parameter capture.
zml_w/zml_ksampler_nodes.py - LLM nodes · External model integration for structured outputs and prompt assistance.
zml_w/zml_llm_nodes.py - HTTP nodes · Request/response nodes for custom HTTP automation flows.
zml_w/zml_http_nodes.py - Logic nodes · Branching, conditionals, and utility control-flow nodes.
zml_w/zml_logic_nodes.py - Parallel nodes · Multi-threaded or parallel sub-workflow orchestration.
zml_w/zml_parallel_nodes.py - Animation nodes · Temporal and animation-oriented processing for image sequences.
zml_w/zml_Animation_nodes.py - Review nodes · Inspection and result-picking nodes for comparing or selecting outputs.
zml_w/zml_review_nodes.py - PS nodes · Photoshop-like editing and annotation workflows inside the graph.
zml_w/zml_ps_node.py - Text annotation · Renders text onto images and supports image annotation workflows.
zml_w/zml_text_annotation.py - XYZ nodes · Parameter sweep and comparison helpers for structured experiments.
zml_w/zml_xyz_nodes.py - Format nodes · Formatting and packaging helpers used across node families.
zml_w/zml_format_nodes.py
Web UI
Browser-side custom controls, previews, and editors.
- Image UI · Browser-side image selection, preview, and interactive image tooling.
zml_w/web/js/zml_Image_node.js - Image v2 · Second-generation image UI boundary for richer interactions.
zml_w/web/js/zml_Image_v2.js - LoRA UI · Folder browsing, hover previews, metadata editing, and weight selection for LoRA assets.
zml_w/web/js/zml_lora_loader.js - Prompt UI · Prompt preset and text editing interface for prompt-heavy workflows.
zml_w/web/js/zml_prompt_ui.js - Text v3 · Dynamic text node UI with editable fields and browser-side behaviors.
zml_w/web/js/zml_text_v3_node.js - Text v4 · Updated text node UI for richer field handling and interactions.
zml_w/web/js/zml_text_v4_node.js - PS UI · Browser-side controls for Photoshop-like editing nodes.
zml_w/web/js/zml_ps_node.js - Resolution UI · Interactive resolution selection controls.
zml_w/web/js/zml_resolution_v3.js - Sampler UI · Sampling and preview controls for orchestration nodes.
zml_w/web/js/zml_ksampler_nodes.js - LLM UI · Browser-side controls for LLM integration nodes.
zml_w/web/js/zml_llm_nodes.js - HTTP UI · Interface for composing HTTP request/response nodes.
zml_w/web/js/zml_http_nodes.js - Pause node · Floating pause-style control for interactive workflow stops.
zml_w/web/js/zml_pause_node.js - Floating ball · Floating mascot/control widget used by the extension UI.
zml_w/web/js/zml_floating_ball.js - Visual cropper · Interactive cropping and visual selection helper.
zml_w/web/js/zml_visual_cropper.js
Assets
Bundled fonts, prompt libraries, sounds, and counters used by nodes.
- Fonts · Bundled fonts used for text rendering and annotation.
zml_w/Font - Prompt library · Static tag lists, preset prompts, and prompt resources.
zml_w/txt - Web prompts · Browser-side prompt dictionaries and prompt completion resources.
zml_w/web/Prompt word
Connections 30
- Entry point → Image nodes: registers · Entry point exposes the image node family.
- Entry point → Text nodes: registers · Entry point exposes text processing nodes.
- Entry point → Prompt nodes: registers · Entry point exposes prompt assembly nodes.
- Entry point → LoRA nodes: registers · Entry point exposes LoRA-related nodes.
- Entry point → KSampler nodes: registers · Entry point exposes sampler orchestration nodes.
- Entry point → HTTP nodes: registers · Entry point exposes HTTP integration nodes.
- Entry point → LLM nodes: registers · Entry point exposes LLM integration nodes.
- Entry point → PS nodes: registers · Entry point exposes editor-like nodes.
- Entry point → Image UI: serves · Python nodes are paired with browser UI modules.
- LoRA nodes → LoRA UI: uses UI · LoRA backend is driven by the asset browser and metadata editor.
- Prompt nodes → Prompt library: loads · Prompt generation consumes bundled text libraries and presets.
- Prompt UI → Web prompts: loads · Prompt editor uses browser-side completion resources.
- Text nodes → Prompt library: formats · Text nodes draw on bundled prompt and tag material.
- Text annotation → Fonts: renders with · Text annotation relies on bundled fonts.
- PS nodes → PS UI: uses UI · Photoshop-like backend logic is paired with browser editing controls.
- Image nodes → Visual cropper: uses UI · Image manipulation includes interactive crop and selection tools.
- Resolution nodes → Resolution UI: uses UI · Resolution nodes are configured through browser controls.
- KSampler nodes → Sampler UI: uses UI · Sampler orchestration is paired with preview and generation controls.
- HTTP nodes → HTTP UI: uses UI · HTTP workflow nodes expose a matching browser interface.
- LLM nodes → LLM UI: uses UI · LLM integration nodes expose a matching browser interface.
- Logic nodes → Parallel nodes: coordinates · Control-flow and parallel orchestration are closely related.
- Image nodes → Text annotation: annotates · Image processing feeds into text-on-image annotation workflows.
- Review nodes → Image nodes: selects outputs · Review nodes inspect and choose among image results.
- Floating ball → Pause node: controls · Floating widget supports interactive pause-style behavior.
- Web prompts → Text v3: supports · Prompt resources support dynamic text editing flows.
- Web prompts → Text v4: supports · Prompt resources support dynamic text editing flows.
- Fonts → Image nodes: supports · Fonts are used by image-centric rendering and preview nodes.
- Prompt library → Prompt nodes: feeds · Static prompt libraries feed prompt generation nodes.
- XYZ nodes → KSampler nodes: sweeps · Parameter sweep workflows commonly drive sampling experiments.
- Format nodes → Prompt nodes: normalizes · Formatting helpers support prompt and text assembly.