ComfyUI Node

Character Encode

Pack a Sprite Into an Identity Object

By Spit8·Created 2 months ago·Updated 2 months ago· 1
Character Encode
  • image
  • mask
  • clip_vision
  • character
namehero
palette_colors8
caption
prompt_template

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 what Save Character uses 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 .char format is a folder named name.char containing meta.json plus tensors.safetensors. Don't be surprised there's no single .char file - 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_vision and 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.

CategoryCharacterPose/Character

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
nameSTRINGhero
palette_colorsINT82–32
maskoptMASK
clip_visionoptCLIP_VISION
captionoptSTRING
prompt_templateoptSTRING

Outputs (1)

NameTypeDescription
characterCHARACTER