Cache Emotion · ComfyUI Emotional Gallery
Cache Emotion is the node that actually writes your expression gallery to disk
- images
EGCacheImage - shown in the menus as Cache Emotion · ComfyUI Emotional Gallery - is the last node in every workflow the gallery generates. It takes the decoded image, drops it into the pack's on-disk cache, and tells the browser panel "card for this emotion, please." That's it. No preview widget, no filename box, no outputs.
Which is exactly why you'll never wire it up on purpose. You'll meet it because a gallery-generated job ran it, or because a workflow you downloaded contains one and you want to know what it's doing before you delete it.
What it's for
The gallery builds a library of face previews per character LoRA: one portrait per expression, cached so you can compare them and copy expression tags out. It's all driven from a side panel - but every thumbnail in that panel comes from a node that runs in a graph and saves a file. EGCacheImage is that node. Its read counterpart is EGLoadCachedEmotion; this is the write.
How it works
The inputs are images (an IMAGE batch), profile_id, and emotion. The gallery's own generated graph feeds it straight from a VAEDecode: loader → EGCharacterEmotion → CLIPTextEncode → KSampler → VAEDecode → EGCacheImage.
On execute it does the following, in order:
- Takes
images[0]only. The source comments say the independent generator always produces exactly one sample, so the node doesn't bother looping over the batch. - Rereads the set's
manifest.jsonand looks upemotionin that set's expression library. If the id isn't there, it raises "Неизвестная эмоция" and the card never appears. - Writes
<emotion>-<random>.pngplus a 320px WebP thumbnail intoComfyUI/user/emotional_gallery/<profile_id>/, then updates the manifest. If that emotion already had an image, the old PNG and WebP are deleted - this is a cache, not a history. - Stamps the PNG with a
emotional_gallerytext chunk containing the settings, the emotion definition and the final positive prompt, so the image is self-describing later. - Returns no values at all.
RETURN_TYPESis empty and the node is flagged as an output node; what it sends back is a UI payload witheg_profileandeg_emotion, which is how the frontend knows which card to fill in.
One detail worth knowing if you're debugging a workflow that won't settle down: its IS_CHANGED returns float("NaN"), the standard ComfyUI trick for "always re-run this." NaN is not equal to itself, so the execution cache can never decide the node is clean. That guarantees a gallery job actually saves instead of being skipped as unchanged - at the cost of defeating caching for anything behind it in that branch.
Inputs and outputs that matter
- images - the IMAGE to cache. Only the first frame survives; a batch of four gives you one PNG.
- profile_id - the 32-character hex id of the target set, not a label you invent. The node's store validates it against
^[0-9a-f]{32}$and will refuse anything else. - emotion - an expression id from that set's library (
neutral,smile,ahegao_rolled, …). Defaults toneutral.
No outputs. Don't try to chain it into anything; the gallery reads the files, not the graph.
Install
You get this node by installing the pack, not by installing the node. From ComfyUI/custom_nodes:
git clone https://github.com/nikminer/ComfyUI-Emotional-Gallery.git comfyui_emotional_gallery
Restart ComfyUI and hard-refresh the browser with Ctrl+F5. The README is explicit that there are no extra Python packages and no JS build step - the extension runs on ComfyUI's own dependencies. There are also no model downloads: it drives whatever checkpoints, encoders, VAEs and character LoRAs you already have. ComfyUI Manager will find it as "ComfyUI Emotional Gallery" if you'd rather click.
The folder name matters for git updates, so don't rename it to something creative.
Common issues
The card stays empty and the console shows a "Неизвестная эмоция" error. The emotion string on the node doesn't exist in that set's manifest. This happens when you hand-edit a cached workflow and change the emotion widget without regenerating the set.
You get a validation error about profile_id. You typed something into the field. It has to be a real set id, which you can read off the directory names under ComfyUI/user/emotional_gallery/.
The image saved but the panel didn't update. The UI payload is what fills the card; if the browser was refreshed mid-generation the event lands nowhere. Reload the page - the PNG is on disk and the panel reads it back from the manifest.
Nothing is where the README says. The cache follows your ComfyUI user directory. If you run with a custom --user-directory, look there instead of ComfyUI/user/.
If you'd rather not have a node writing into that folder at all, bypass it. Nothing downstream depends on it, because nothing downstream exists.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| profile_id | STRING | — | |
| emotion | STRING | neutral | — |
Outputs (0)
No outputs