A5 Custom Nodes
A collection of A5 prompt, text, image, and latent nodes for ComfyUI.
Nodes (10)
Borrow the text encoder you already loaded
A local LLM enhancer that gets out of your VRAM's way
Six Reference Images Without Six Load Image Nodes
Stop keeping your notes in twenty abandoned workflows
Think in megapixels, not in width and height
A bigger canvas, and the mask to fill it
Three shelves for the prompts you keep retyping
Scale and letterbox in a single node
Pipe text in without losing the box you type in
The empty latent, with the model-specific parts hidden
A5 Custom Nodes
A collection of ten custom nodes for ComfyUI covering prompt enhancement, prompt and note storage, text input, latent presets, image loading, scaling, and outpainting utilities.
Existing A5 node IDs are preserved so workflows created with the standalone versions remain compatible.
Changes in 0.1.3
- Added previous/next image arrows and a per-slot context menu to Multi Image Load.
- Added eight shared, editable snippets and a movable, resizable popout editor to the regular A5TextPrompt node. No experimental node is required.
- Saved snippets remain local in
comfyui_A5TextPrompt/snippets.json; preserve that file when replacing the pack directory.
Changes in 0.1.2
- Fixed CLIP prompt enhancement to pass the system prompt through the model's chat template instead of combining it with the user prompt.
- Added A5 Multi Image Load with six reference outputs and an original-image list.
- Updated scale/padding to generate solid-color canvases without an input image and provide an empty latent output. Latent dimensions round up independently to multiples of 8; this output is not an encoding of the image.
A5 Multi Image Load
A compact 2-column × 3-row image loader with six independent IMAGE outputs
and an image_list output for processing images individually. No masks or
combined batch are produced.
- Use each slot's previous/next arrows to browse the available image filenames.
- Load each reference using its upload button, filename list, drag-and-drop, or clipboard paste. Right-click any slot, including an empty one, for Paste image, Copy image, and Copy (Clipspace) when supported. Copy uses the original image. Right-click then Escape also selects a slot for Ctrl+V without opening a dialog. Click a loaded thumbnail for a larger preview.
- Uncheck a tile to bypass its reference and exclude it from the list. The file
and cable remain in place; the other output numbers never move. Empty and
bypassed references return
None, for receivers that accept absent images (such as the Qwen multi-reference encoders). Required-image processors need an active reference. - Drop multiple files on a tile to fill empty slots starting there and wrapping through the remaining slots. Existing slots are preserved; overflow becomes extra images. A single file replaces the targeted slot.
- Resize changes only the six reference outputs, using the selected
megapixel target, Lanczos and the original aspect ratio. It starts disabled
with a 1 MP target. Downscale only is available in the node menu and the
⋯options button. Dimensions are rounded to pixels, not model multiples. - The bottom drop/paste area and
+button append extras. Click its count to reorder or remove entries. Clear extras preserves every preview slot and never deletes files. Duplicate collection entries are retained. image_listcontains the original, unresized active slots in numerical order, followed by the extras. Each list item is a single-image tensor; different sizes and aspect ratios are preserved. Normal ComfyUI list processing invokes downstream nodes for each item. An empty collection skips its processing branch. Any additional resizing/batch conversion belongs downstream.
Selections, bypass states, collection order and resize settings are stored in the workflow. Uploaded files use ComfyUI's normal input storage and must still be available when reopening the workflow on another machine. Decoding uses the installed core Load Image implementation; animated files contribute their first frame. The custom DOM controls support Classic and Nodes 2.0, using the normal Load Image file choices in a searchable text list.
Backend/API input: state is a JSON string with version: 1, six
slots: [{file, enabled}, ...], extras: [filename, ...], resize,
megapixels, and downscale_only. Only the last output has OUTPUT_IS_LIST.
Run regression checks from the repository root:
python -m unittest tests.test_multi_image_load tests.test_pack_loader
node tests/test_multi_image_state.mjs
node tests/test_multi_image_frontend.mjs
Validated with the installed ComfyUI 0.37.0 in an isolated CPU test server: mixed-size list execution and pixel preservation, independent reference resize, empty-list branch skipping, and uploads/paste, preview dialogs, collection management, save/reload and duplication in the browser. The compact widget was checked in both Classic and Nodes 2.0. Each bypass position was also exercised against the Qwen Image 2.1 input handler without loading model weights; full Qwen/H3 model generation is not part of these checks.
Installation
Clone or extract this repository into ComfyUI/custom_nodes, then restart
ComfyUI and refresh the browser. Disable any standalone copies of these nodes
to avoid duplicate registrations.
Now also on github and in ComfyUI manager
When installig via Comfy Manager, don't use the Nightly version, but select the numbered one
No additional Python packages are required. Detailed node documentation and screenshots below.
<hr>NOTE: This readme was copied from the slightly messy HF repo, despite some editing, formatting and layout may not be perfect. But it says what it should.
little youtube video on most of these nodes. https://youtu.be/Hhowg7dzk-0
A5lmstudio_prompt_enhancer: Comfyui Prompt enhancer node, using a local model (localhost server, Lm Studio and others) Including INTELLIGENT loading/unloading and (Auto) bypass modes.
this image shows the current/recent ui version. As does the Youtube video. All other guides/images further down show the old one, which is functionally exactly the same! <img src="https://cdn-uploads.huggingface.co/production/uploads/67786db89328893864293f2c/8zta4RY4DvzZL0EcWEdYB.png" width="650" alt="Thumbnail"> <br>
Firefox warning: There are currently unsolved issues in ComfyUI's nodes 2.0 with Firefox. I HIGHLY recommend using classic nodes with Firefox
(in general tbh, 2.0 is ...) These nodes work fully as intended in classic node mode in both browsers. If you have to switch to nodes 2.0 and it messes stuff up, reload the node (context menu, not just R) , when back in classic node mode! Chromium works fine in both modes.
In nodes 2.0 both nodes work functionally, even in firefox.
But resizing nodes smaller seem to be broken (i tried fixing this node a LOT before realizing it being Comfy+firefox issue.
The dynamic Duo at work, quickly explained:
They, and all others, can be used individually of course.
First the big one:
LMStudio Prompt Enhancer (Also other localhost openai api servers (partly?).
Screenshots may show the previous UI, function is identical.
Send any system prompt to a localhost server (Example LMStudio) and/or a user prompt (to improve) and/or a image.
Then get the llm's enhanced prompt back, exportable as string for any text input in Comfyui.
Intelligent (or manual) bypassing:
- Three modes "Always run LLM", "Bypass - send last/manual prompt" (full bypass) and "Bypass if unchanged" (auto)
- "Manual Bypass", runs last extended prompt (whatever is in the lowest text field) again, which can be manually edited!).
- "Aways run LLM", you guessed, it always runs the llm. (get a new enhanced prompt every time, may have its uses)
- "Bypass if unchanged", the "intelligence":
- It also sends the last enhanced prompt, IF input image and/or prompts and/or selected LLM model have NOT changed.
- IF input prompt, selected LLM or image has changed, it runs the LLM again, creating a new enhanced prompt, overwriting the old one.
- Last prompts remains in the 20 step history (see below)
Editing Box, Bypass switches and 20 prompt history:
- Manual Edits in the lower field or the editing box do NOT trigger another llm run. You can use this essentially as the default text prompt box. That field and the box are linked.
- The lowest button in the node ("Edit last Prompt") Opens a separate text box. This is a direct instance of that lowest text field (the enhanced prompt).
- it has switches for "Bypass" (=manual bypass) and "auto" These are instances of the main nodes bypass options. (Exception: If the main node is set to "Always run LLM" these bypass switches are ignored.
- it has a 20 step history. The last 20 prompts in this field can be selected back and forth. This is updated after changes once you click outside the editing box, OR when the workflow runs.
- It opens as a resizable always-on-top window for comfortable editing, however small and far away the main node is.
This functionality (to edit the enhanced prompt) is the main reason, i made my own. So i don't have to copy and paste stuff between prompt and clip textfields to use an already anhanced prompt again AND be able to make edits to it myself. . manual edits to the enhanced prompt are ignored in the bypass check!
Server options: dropdown list. Load/unload LLM before run. unload Comfy models before LLM run.
- More Options: Api token, max tokens, (it auto removes thinking blocks but they still count for the limit!)
- LLM select dropdown. For more compatibility for openai api servers other than LMStudio, we use a more generic server get list instead of th neat LMStudio specific one. Combined with little algorithm to mark likely vision capable models.
switches:
- Unload ComfyUi models from Vram (ONLY) if LLM is run. It will ONLY do that if the LLM is actually run. Respecting all bypass options.
-
- So IF lmstudio loads the llm to do your prommpt, it does not crash with a big Comfyui image model still in your vram.
- Load LLM / Unload LLM: If both on, it automatically loads the LMStudio LLM, ONLY if needed, runs the prompt enhancing, then unloads the LLM again
- I recommend leaving all three switches on, so LLM and Comfy models never crash in Vram or system ram.
###Important caveats on these:
-
LM Studio (not me) requires authentication with token for the loading/unloading options. If you set the dropdown to "Use loaded / Default model", the top entry, you do not need a token but load/unload will not work.
-
- It also will return an error if NO model is loaded in LM Studio.
- Image below: You need those settings in LMStudio (left) set, for those features in the Node (Right) to work!- - Including a token set in LMStudio and entered in the node!

- Vision for images: Sending a image with your prompt requires a vision model to be loaded of course. The list shows an educated guess, but no precise pull.
- NON LM Studio server: This should work with any openai compatible server, but it was made and tested using LM; Studio. Especially the model loading/unloading may not work with other servers.
- Also keep in mind this was made for local use with a local llm, on a single computer. So it deliberately balances convenience and complexity with safety. The server token is never displayed in the node (XXX) BUT is saved in plain text in that json file.
Prompt Database Node:
Save multiple prompts (or whatever) with names, in three different categories (three separate sets of saved prompts). It's stored in the node's folder, in json file. so all saved prompts are available in any workflow in your comfy installation. Should be simple to understand.
save/updae: if name (title, top field) for an entry is not changed, it updates the entry. If name is changed a new entry is created.
Of course it doesn't have to be prompts. You can use it as simple database for whatever, any name and any text. Keep in mind it is saved in plain text in the nodes local folder! (a5prompt_database.json)
quick look at the smaller nodes:
Scale to total pixels safe (now with Image padding).
- Scale to pixel number, multi 8/16/32, scale only up, only down or both, select resacle method.
- exports the rescaled image. Exports the width and height as int. Displays the output resolution. Allows manual width and height override. With or without preserving Aspect.
Image padding:
Padding mode enabled
- IF manually width and height are entered as override and "Keep Aspect" is OFF
- OR you select a aspect ratio from the dropdown
- you can select the options: stretch (image). Or Padding.
Padding opens up the padding section. Fill the resized part of the image that is NOT the image (Letterbox) with a selectable and pickable color. Padding left/top or right/bottom of the image. select color from elsewhere on the comfy canvas, example from the background color of your input image edge to match it for the padding. This was a mess because of browsers and ndoes2.0. The dedicated "Pick color" button works in every combiantion (click the cursor on the needed color. <img width="750" height="300" alt="image" src="https://github.com/user-attachments/assets/3a6067f7-7f1a-452e-af83-db6e22ced40d" />
A5 Pad Image for Outpaint
Similar to the above but as dedicated padding only node. <img width="700" height="200" alt="image" src="https://github.com/user-attachments/assets/f3614b28-4498-4f38-8c16-ba13f8cddc72" />
The node A5_only scale to total pixels
is the rescale only node, without the padding stuff. Unlocking aspect simple stretches the image. (btw the "safe" in the name is ancient and means the multiples-math. that was the og motivation for it.)
A5 Universal latent presets
Set latent format to Flux.2 OR Flux.1, SD3... the Main one, or hidreamo1. Presets for 1, 2, 3 and 4 Mpx, All the usual aspect ratios, invert button to switch to portrait (vertical mode). There was a similar node for (only) Flux.2, but it outputted the wrong size (latent was twice what you selected).

A5 Text Prompt
A text prompt node. BUT the text inside is shown AND remains editable! A switch to allow or block a external inout overwriting the text currently in your box. Text outputted as string. Aim: Not to have to disconnect and copy and paste around if i want to edit what was last sent to this box. stores up to 20 last, saves when one is sent in externally OR you type and then click outside of the node. They are NOT persistent over Comfy retarts and stored per workflow. But can be exported. Connect external stings to the External Input connector, NOT to the textbox. <img width="344" height="220" alt="image" src="https://github.com/user-attachments/assets/4d81f115-230a-4a63-8f76-006b49bdbd2c" />
It is basically the simpler, text only, undo capable text editing part of my PromptEnhancer node
The popout icon beside the history/export controls opens a movable, resizable editor above the ComfyUI canvas. It edits the same text as the node, immediately in both directions, and includes the same 20-prompt history and text export. It stays open during execution and when the node is off-screen or zoomed out. Press Escape while focused inside it to close; closing commits pending edits. The popout does not resize the node. External text replacement still follows the node's existing allow/block switch.
Eight snippet buttons are available in both the node and popout. Clicking one inserts its exact text at the cursor (or replaces only the selected text), without replacing the rest of the prompt. Hover for the full snippet content. Expand Edit snippets to choose a slot, edit its label/text, and save or clear it. The settings start collapsed; there are no categories. Include any wanted spaces/newlines in the snippet itself.
Snippet clicks behave like typing, not separate history entries. A completed edit is captured on leaving the text field or queueing a run; closing the popout, history navigation and export also capture pending edits. In Nodes 2.0, only the text field expands to use spare space, including after the snippet settings are collapsed. Classic and popout sizing remain independent.
Snippets are shared across this node's instances and workflows and saved in
comfyui_A5TextPrompt/snippets.json inside the pack. Preserve that file when
replacing the pack directory. The experimental node is no longer needed;
the pack uses its own code, endpoint and data, with no dependency on it.
The regular node name remains A5TextPrompt.
Text-node regression checks:
python -m unittest tests.test_a5_text_prompt tests.test_text_snippets tests.test_pack_loader
node tests/test_a5_text_prompt_frontend.mjs
node tests/test_snippet_frontend.mjs
With Playwright available, tests/test_text_prompt_browser.cjs checks the live
node in Classic and Nodes 2.0. Set COMFY_TEST_URL to an isolated test server
with only this pack enabled. PLAYWRIGHT_CHROMIUM_EXECUTABLE can select a local
browser. The test changes that test server's UI settings.
A5 Note database
Say goodby to separate notes-workflow or 20 markdown notes in different workflows: Very similar to my prompt database. Only it handles notes. Save with name, new name=new entry, same name=upated existing note. Dropdown with all notes in the category, three categories, 6 buttons for the most recernt entires directly in the node. Tooltip of note names in drop down and buttons shows full one. Future updates will be backwards compatible. Notes are saved locally in the nodes Custom_nodes folder.
This is WiP i'm not happy with the display of the notes yet. The database and storage works very well. The display as Markdown is WiP.

Prompt History
A5TextPrompt and the LM Studio and CLIP prompt enhancers keep up to 20 distinct prompts per node. Manual edits are captured when you leave the text field, close the popout editor, or queue a workflow run. History navigation and export also capture any pending edit. New generated or incoming prompts are saved automatically. Reusing an older prompt selects its existing entry; editing it adds a new one without discarding newer entries. Only exceeding the 20-entry limit removes the oldest prompt.
History survives editor closing, node reconfiguration, and switching workflow tabs within the same page session. It is kept in memory, scoped to ComfyUI's workflow/subgraph/node IDs, and is not written to workflow files or local config. A browser refresh or restart clears it. Workflows with distinct IDs have separate histories; copies that preserve all those IDs share that session history.