IF Image to Prompt🖼️
Feed it an image, get back a Stable Diffusion prompt you can actually use
- images
- mask
- Omni
- question
- response
- negative
- omni
- generated_images
- mask
IF Image to Prompt is the reverse-engineering node of the IF_AI_tools pack. You drop in an image, it asks a vision LLM to describe it, and the response output comes back as a ready-to-paste Stable Diffusion prompt. It's the fastest way to grab the "vibe" of a reference image - a style you found on Civitai, a screenshot, a mood board - without hand-writing keywords. Wire the response straight into a CLIP Text Encode and you're generating variations within a minute.
The pack name tells you the design lineage: this is the same family as IF Prompt Maker, sharing the identical input schema. Both are being migrated to the newer ComfyUI-IF_AI_PromptImaGen repo, so treat them as the mature, stable versions of that idea.
How it works
The node takes your images, converts them for API/local consumption (the pack has a convert_images_for_api helper for this), and sends them to the LLM with a system prompt that instructs it to write SD-style prompts. Which system prompt it uses is up to you: the profiles dropdown pulls from JSON files in the pack's IF_AI/presets folder - IF_PromptMKR, IF_Omost, IF_HunyuanVideoPrompt, and ~27 others, all editable if you want your own.
The strategy input changes the whole behavior:
normal- describe the image as a prompt (the default).omost- use the Omost tool to produce structured canvas-conditioning layout data instead of plain text.create/edit/variations- switch to generating images via the OpenAI image API, which is whybatch_countexists.
On top of that you get the pack's preset stacks: embellish_prompt, style_prompt, and neg_prompt (63 styles, 29 embellishments, 24 negatives) which get glued onto the LLM's response. The auto / auto_mode toggles batch up to four images at a time through combo/mix prompt modes.
The inputs that matter
images- the reference image(s). This is the whole point.llm_provider/llm_model-ollama+ a vision model likellama3.2-visionis the free path; the cloud providers need their env keys.user_prompt- an extra instruction, e.g. "describe the lighting and composition in detail."profiles- the system-prompt preset that shapes the output.
Outputs: response (the prompt - feed to CLIP Text Encode), negative (if a negative preset is active), question (echo), omni (tool payload for omost strategy), generated_images and mask (for the create/edit/variations strategies).
Installation
ComfyUI Manager, search "IF_AI_tools". Or:
cd ComfyUI/custom_nodes
git clone https://github.com/if-ai/ComfyUI-IF_AI_tools.git
Then pip install -r requirements.txt (a long list - the RAG stack like byaldi and sentence-transformers is included even though this node doesn't strictly need it), and make sure you have Ollama running with a vision model if you're going local.
Gotchas
The obvious trap: your chosen model must actually be a vision model. Ollama will cheerfully accept llama3.2 (text-only) and return garbage or an error when you feed it images - ollama run llama3.2-vision first. And remember the repo is archived: the author moved on to comfy-deploy's LLM toolkit, so don't expect new features here. If all you want is image-to-prompt, the current recommendation is the successor PromptImaGen node, which requires you to disable this pack first - the two will collide.
Inputs (32)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| llm_provider | COMBO | 12 options: xai, llamacpp, ollama, kobold, lmstudio, textgen, +6 | |
| llm_model | COMBO | 0 options: | |
| base_ip | STRING | localhost | — |
| port | STRING | 11434 | — |
| user_prompt | STRING | — | |
| strategyopt | COMBO | normal | 5 options: normal, omost, create, edit, variations |
| maskopt | MASK | — | |
| prime_directivesopt | STRING | The system prompt for the LLM. | |
| profilesopt | COMBO | None | The pre-defined system_prompt from the json profile file on the presets folder you can edit or make your own will be listed here. |
| embellish_promptopt | COMBO | The pre-defined embellishment from the json embellishments file on the presets folder you can edit or make your own will be listed here. | |
| style_promptopt | COMBO | The pre-defined style from the json style_prompts file on the presets folder you can edit or make your own will be listed here. | |
| neg_promptopt | COMBO | The pre-defined negative prompt from the json neg_prompts file on the presets folder you can edit or make your own will be listed here. | |
| stop_stringopt | COMBO | Specifies a string at which text generation should stop. | |
| max_tokensopt | INT | 20481–8192 | Maximum number of tokens to generate in the response. |
| randomopt | BOOLEAN | false | Toggles between using a fixed seed or temperature-based randomness. |
| seedopt | INT | 0 | Random seed for reproducible outputs. |
| temperatureopt | FLOAT | 0.700–1 | Controls randomness in output generation. Higher values increase creativity but may reduce coherence. |
| top_kopt | INT | 40 | Limits the next token selection to the K most likely tokens. |
| top_popt | FLOAT | 0.90 | Cumulative probability cutoff for token selection. |
| repeat_penaltyopt | FLOAT | 1.10 | Penalizes repetition in generated text. |
| keep_aliveopt | BOOLEAN | false | Determines whether to keep the model loaded in memory between calls. |
| clear_historyopt | BOOLEAN | false | Determines whether to clear the history between calls. |
| history_stepsopt | INT | 10 | Number of steps to keep in history. |
| aspect_ratioopt | COMBO | 1:1 | Aspect ratio for the generated images. |
| autoopt | BOOLEAN | false | If true, it generates auto promts based on the listed images click the save combomix settings to set the auto prompt generation file |
| auto_modeopt | BOOLEAN | false | If true, it generates a prompt for each image with Combo mode and Mix mode combined a maximum of 4 images in the list then moves to the next 4 and use it to run a job as many times as your batch count is set. the settings are taken from the yaml file |
| batch_countopt | INT | 4 | Number of images to generate. only for create, edit and variations strategies. |
| external_api_keyopt | STRING | If this is not empty, it will be used instead of the API key from the .env file. Make sure it is empty to use the .env file. | |
| precisionopt | COMBO | Select preccision on Transformer models. | |
| attentionopt | COMBO | Select attention mechanism on Transformer models. | |
| Omniopt | OMNI | Additional input for the selected tool. |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| question | STRING | — |
| response | STRING | — |
| negative | STRING | — |
| omni | OMNI | — |
| generated_images | IMAGE | — |
| mask | MASK | — |