# lbh-123-ai/comfyui-wan-latent-resizer architecture

> Architecture diagram of the GitHub repository lbh-123-ai/comfyui-wan-latent-resizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lbh-123-ai/comfyui-wan-latent-resizer
- Repository: https://github.com/lbh-123-ai/comfyui-wan-latent-resizer

## Overview

This repository is a ComfyUI custom-node plugin for learned Wan latent resizing. The principal workflow takes an image or video latent through a version-specific node, loads a matching learned model, and returns a resized latent for downstream decoding or refinement. The README documents both Wan versions, up/downscaling, arbitrary scale factors, and image/video latent support. Source excerpts show node registration, model loading, and resizing internals; Wan2.2 details are partial, so uncertain internal wiring is omitted.

Main entry points: [`nodes/wan2_1_latent_Resizer_nodes.py`](https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/wan2_1_latent_Resizer_nodes.py) (Wan2.1 node), [`nodes/wan2_2_latent_Resizer_nodes.py`](https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/wan2_2_latent_Resizer_nodes.py) (Wan2.2 node), [`nodes/__init__.py`](https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/__init__.py) (Node registry), [`__init__.py`](https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/__init__.py) (Plugin exports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugin["ComfyUI Plugin"]
  node_entry["Plugin exports<br/>[__init__.py]"]
  node_registry["Node registry<br/>[__init__.py]"]
end

subgraph group_wan21["Wan2.1 Resizing"]
  node_node21["Wan2.1 node"]
  node_net21["Wan2.1 resizer network"]
end

subgraph group_wan22["Wan2.2 Resizing"]
  node_node22["Wan2.2 node"]
  node_net22["Wan2.2 resizer network"]
end

subgraph group_models["Learned Models"]
  node_model21["Wan2.1 weights"]
  node_model22["Wan2.2 weights"]
end

node_comfy(("ComfyUI workflow"))
node_latent["Wan image/video latent"]
node_result["Resized latent"]
node_decode["Decode or refine"]

node_comfy -->|"loads plugin"| node_entry
node_entry -->|"exports mappings"| node_registry
node_registry -->|"registers"| node_node21
node_registry -->|"registers"| node_node22
node_comfy -->|"dispatches latent"| node_node21
node_comfy -->|"dispatches latent"| node_node22
node_latent -->|"input latent"| node_node21
node_latent -->|"input latent"| node_node22
node_node21 -->|"loads weights"| node_model21
node_node22 -->|"loads weights"| node_model22
node_node21 -->|"invokes resizing"| node_net21
node_node22 -->|"invokes resizing"| node_net22
node_node21 -->|"returns latent"| node_result
node_node22 -->|"returns latent"| node_result
node_result -.->|"feeds workflow"| node_decode

click node_entry "https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/__init__.py"
click node_registry "https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/__init__.py"
click node_node21 "https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/wan2_1_latent_Resizer_nodes.py"
click node_node22 "https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/wan2_2_latent_Resizer_nodes.py"
click node_model21 "https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/models/wan2.1_latent_resizer_fp16.safetensors"
click node_model22 "https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/models/wan2.2_latent_resizer_fp16.safetensors"
click node_net21 "https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/wan2_1_latent_Resizer_nodes.py"
click node_net22 "https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/wan2_2_latent_Resizer_nodes.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_registry,node_comfy toneBlue
class node_node21,node_net21 toneAmber
class node_node22,node_net22 toneMint
class node_model21,node_model22 toneRose
class node_latent,node_result,node_decode toneIndigo
```

## Components

### ComfyUI Plugin

- [Plugin exports](https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/__init__.py): `__init__.py`
- [Node registry](https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/__init__.py): `nodes/__init__.py`

### Wan2.1 Resizing

- [Wan2.1 node](https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/wan2_1_latent_Resizer_nodes.py): `nodes/wan2_1_latent_Resizer_nodes.py`
- [Wan2.1 resizer network](https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/wan2_1_latent_Resizer_nodes.py): `nodes/wan2_1_latent_Resizer_nodes.py`

### Wan2.2 Resizing

- [Wan2.2 node](https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/wan2_2_latent_Resizer_nodes.py): `nodes/wan2_2_latent_Resizer_nodes.py`
- [Wan2.2 resizer network](https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/nodes/wan2_2_latent_Resizer_nodes.py): `nodes/wan2_2_latent_Resizer_nodes.py`

### Learned Models

- [Wan2.1 weights](https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/models/wan2.1_latent_resizer_fp16.safetensors): `models/wan2.1_latent_resizer_fp16.safetensors`
- [Wan2.2 weights](https://github.com/lbh-123-ai/comfyui-wan-latent-resizer/blob/main/models/wan2.2_latent_resizer_fp16.safetensors): `models/wan2.2_latent_resizer_fp16.safetensors`

### Other components

- **ComfyUI workflow**
- **Wan image/video latent**
- **Resized latent**
- **Decode or refine**

## Connections

- ComfyUI workflow → Plugin exports: loads plugin
- Plugin exports → Node registry: exports mappings
- Node registry → Wan2.1 node: registers
- Node registry → Wan2.2 node: registers
- ComfyUI workflow → Wan2.1 node: dispatches latent
- ComfyUI workflow → Wan2.2 node: dispatches latent
- Wan image/video latent → Wan2.1 node: input latent
- Wan image/video latent → Wan2.2 node: input latent
- Wan2.1 node → Wan2.1 weights: loads weights
- Wan2.2 node → Wan2.2 weights: loads weights
- Wan2.1 node → Wan2.1 resizer network: invokes resizing
- Wan2.2 node → Wan2.2 resizer network: invokes resizing
- Wan2.1 node → Resized latent: returns latent
- Wan2.2 node → Resized latent: returns latent
- Resized latent → Decode or refine: feeds workflow
