Character Encode
Pack a Sprite Into an Identity Object
- image
- mask
- clip_vision
- character
Most of this pack's fast pipeline treats your sprite as just an image - a reference you hand to a diffusion model and cross your fingers. CP_CharacterEncode is the other path: it bundles the sprite into a CHARACTER object that carries your hero everywhere as a unit. Think of it as the pack's identity wallet - reference image, color palette, optional CLIP-Vision embedding, and whatever metadata you want, all in one object that you can save, reload, and pass around the graph.
You'll reach for it when you want a character that persists: encode once, save, and every future workflow loads the same identity from disk instead of re-deriving it.
How it works
The node bakes four things into a CHARACTER:
- reference_image - the sprite itself, normalized to float in [0,1].
- palette - a K-means color extraction (
palette_colors, default 8) used by the caption/color-lock machinery downstream. - embedding - if you pass a clip_vision model, a CLIP-Vision embedding of the image (the identity signal IP-Adapter-style pipelines want).
- metadata - any caption and prompt_template you supply get stored here too.
The mask input is the one worth knowing about. If you give it a mask, the sprite is composited onto a neutral gray background before encoding, so the background around the character doesn't leak into the identity. Hand it a cutout mask and your character object is about the character, not its old backdrop.
The inputs that matter
- image - the sprite (required).
- name - default
hero. This is whatSave Characteruses as its filename. - palette_colors - 8 by default.
- mask / clip_vision / caption / prompt_template - all optional, all worth filling in if you're building a reusable character.
Output is a single character object. Wire it into CP_SaveCharacter to persist it, or straight into CP_CharacterRender / CP_CharacterRepair.
Installing
Same pack as everything else - Spit8/_ComfyUI_CharacterPose:
cd ComfyUI/custom_nodes
git clone https://github.com/Spit8/_ComfyUI_CharacterPose
pip install -r _ComfyUI_CharacterPose/requirements.txt
Restart ComfyUI, find it under CharacterPose/Character. The CLIP-Vision path needs a CLIP-Vision model loaded, but the node works fine without one.
Gotchas
- The
.charformat is a folder namedname.charcontainingmeta.jsonplustensors.safetensors. Don't be surprised there's no single.charfile - that's just how it's stored. - Without a mask, whatever background is in the sprite gets encoded into the reference and the palette. A clean sprite crops dramatically better.
- Skip
clip_visionand the object still works - you just lose the embedding, which matters mainly for the SDXL/IP-Adapter render path.
Encode once, save, reuse. That's the entire pitch, and for a game-art pipeline it's the right one.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| name | STRING | hero | — |
| palette_colors | INT | 82–32 | — |
| maskopt | MASK | — | |
| clip_visionopt | CLIP_VISION | — | |
| captionopt | STRING | — | |
| prompt_templateopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| character | CHARACTER | — |