Pic2Story_Sampler
The Sampler that turns pixels into sentences
- image
- model
- prompt
Pic2Story_Sampler is where the captioning actually happens. The Loader gets the model into memory; this node takes an image, runs it through that model, and returns the text. It's the second half of the Loader/Sampler pair, and if you're describing many images with one loaded model, this is the node you keep firing.
Mechanically it's textbook BLIP captioning, with one detail worth understanding. It converts the ComfyUI image tensor back to a PIL image, then feeds it to the processor. If your prompt input is empty, it does unconditional captioning - the model just describes the image on its own. If the prompt is filled in (the default is a photography of), it does conditional captioning, continuing from that seed. The "story" in Pic2Story comes from the fine-tuned checkpoint: it's been trained to produce narrative sentences rather than flat tags, so the output reads like prose, not a keyword list.
The BLIP path also respects the inference_mode the Loader set: float16 tensors on GPU if you chose gpu_float16, plain tensors for gpu or cpu. And if you've pointed the Loader at a PaliGemma repo instead, the Sampler quietly switches behavior - an empty prompt becomes describe en, it generates with a cap of 128 new tokens, and it strips the instruction prefix from the result so you just get the description.
The inputs that matter
image- theIMAGEtensor you want described.model- thePICMODELfrom Pic2Story_Loader. Nothing else feeds this input; don't try to fake it with a string.prompt- defaulta photography of. Here's the part beginners get wrong: the README says the prompt is not necessary. Leave it empty and the model describes the image plainly. Fill it and you steer the story's direction - trya dark fantasy scene of,the story begins when, whatever flavor you want.
The output
One output, confusingly also named prompt: a STRING with the generated caption. It's just text, so it can go anywhere - a Save Text node, a text display, or back into a generation prompt if you're building a loop. That round-trip - image, to caption, to prompt, to new image - is honestly the most interesting thing this pack enables.
One honest warning on expectations. BLIP has a lousy reputation in the captioning-for-training crowd, and that reputation is earned - for training captions it's weak, and the KB's captioning guidance says as much. But that's not this job. Here you want readable sentences about an image, which is exactly what BLIP is good at. If you came here expecting a detailed tag list like a WD14 tagger produces, you'll be disappointed; if you want a story, you're in the right place.
How to install
The pack installs once and brings all its nodes with it. ComfyUI Manager, search "Pic2Story", install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/smthemex/ComfyUI_Pic2Story.git
then restart ComfyUI. No requirements.txt ships with it, so confirm transformers is installed in ComfyUI's Python (pip install transformers) or the import fails. And remember: the first run downloads the checkpoint, so your first queue isn't representative of the ones after.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model | PICMODEL | — | |
| prompt | STRING | a photography of | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |