ComfyUI Node

Character Caption

Florence-2 Plus a Color Lock That Actually Sticks

By Spit8·Created 2 months ago·Updated 2 months ago· 1
Character Caption
  • image
  • character
  • caption
  • edit_prompt
  • palette_hex
  • caption_backend
  • character
model_idmicrosoft/Florence-2-base
style_bias2D game sprite, cartoon line art
max_tokens128
palette_colors8
use_cached_captiontrue
prop_hint
extra

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 CHARACTER in, the node reads its cached caption from the .char metadata 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 says fallback_heuristic, you're not getting real captions - you either skipped transformers or 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."

CategoryCharacterPose/Character

Inputs (9)

NameTypeDefaultDescription
imageIMAGE
model_idSTRINGmicrosoft/Florence-2-base
style_biasSTRING2D game sprite, cartoon line art
max_tokensINT12832–256
palette_colorsINT83–16
characteroptCHARACTER
use_cached_captionoptBOOLEANtrue
prop_hintoptSTRING
extraoptSTRING

Outputs (5)

NameTypeDescription
captionSTRING
edit_promptSTRING
palette_hexSTRING
caption_backendSTRING
characterCHARACTER