Character Caption
Florence-2 Plus a Color Lock That Actually Sticks
- image
- character
- caption
- edit_prompt
- palette_hex
- caption_backend
- character
Describe a sprite well enough that a generator can reproduce the same character in a new pose, and you've won half the consistency fight. CP_CharacterCaption is the pack's answer: it runs Microsoft's Florence-2 (the small, MIT-licensed VLM that became the community's default lightweight captioner) over your sprite, then - this is the clever bit - adds a K-means hex color palette straight into the prompt so the color identity doesn't drift.
The reasoning is sound and it's worth internalizing: captions describe but don't reproduce. A VLM will happily write "a knight in silver and blue armor," and the diffusion model will re-imagine the silver as steel-gray or sky-blue. Hex values don't leave that much room.
How it works
The node crops the image to its content so Florence-2 focuses on the character instead of empty canvas, runs an image-to-text pass, then enriches the result with your style_bias and the palette. It returns a backend string so you always know what actually produced the caption.
If transformers isn't installed, or Florence-2 comes back empty, it falls back to a pure K-means palette caption and tells you via caption_backend (fallback_heuristic (...)). So the node never silently fails - it degrades and labels the degradation.
The inputs that matter
- image - the sprite.
- model_id - default
microsoft/Florence-2-base. Weights download from Hugging Face on first run. Set it to a local path if you've got Florence-2 in your ComfyUI models folder already. - style_bias - default
"2D game sprite, cartoon line art". This is your lever for nudging the description toward your art style. - max_tokens / palette_colors - caption length (128) and how many colors go in the lock (8).
- character + use_cached_caption - if you pass a
CHARACTERin, the node reads its cached caption from the.charmetadata and skips the model entirely. Huge time-saver on repeat runs.
Outputs: caption, edit_prompt (caption + palette + hints, already assembled), palette_hex, caption_backend, and character - the input character (or a fresh one) with all of it stuffed into its metadata.
Installing
It's part of Spit8/_ComfyUI_CharacterPose:
cd ComfyUI/custom_nodes
git clone https://github.com/Spit8/_ComfyUI_CharacterPose
pip install -r _ComfyUI_CharacterPose/requirements.txt
The requirements.txt has transformers>=4.41.0 commented as "recommended" - install it or you're stuck on the heuristic fallback. Restart ComfyUI and look under CharacterPose/Character.
Gotchas
- First run downloads Florence-2 weights. Expect a one-time wait and a few hundred MB in your Hugging Face cache.
- Check
caption_backend. If it saysfallback_heuristic, you're not getting real captions - you either skippedtransformersor the model path is wrong. - The cached-caption path is per-character: caption once, save the
.char, and every future run is instant. Build that habit early.
If you use one node from this pack's identity side, make it this one - the caption plus the palette lock is the difference between "same character" and "a knight that happens to look related."
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model_id | STRING | microsoft/Florence-2-base | — |
| style_bias | STRING | 2D game sprite, cartoon line art | — |
| max_tokens | INT | 12832–256 | — |
| palette_colors | INT | 83–16 | — |
| characteropt | CHARACTER | — | |
| use_cached_captionopt | BOOLEAN | true | — |
| prop_hintopt | STRING | — | |
| extraopt | STRING | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| caption | STRING | — |
| edit_prompt | STRING | — |
| palette_hex | STRING | — |
| caption_backend | STRING | — |
| character | CHARACTER | — |