ComfyUI-Info-Prompt-Toolkit
Selectively encrypt prompts, model details, and other generation data you do not want to expose, while saving the rest as A1111/Civitai-compatible metadata. This toolkit’s reader nodes restore encrypted fields, so you can control what an image reveals without giving up reusable generation settings.
Built around image_info, it simplifies ComfyUI wiring and makes trial results easier to carry into your next production pass. It also includes same-name .txt caption saving, XY Plot, Tiled Sampling (SDXL (with ControlNet Tile) and Anima), SAM3, Detailer, PixAI Tagger, OppaiOracle Tagger, wildcards, and Dynamic Prompts.
Guide: Using A1111/Civitai-Compatible Metadata: Encrypt Only the Generation Data You Don’t Want to Share — An illustrated guide to saving, restoring, reusing, and selectively encrypting image metadata.
Installation
cd ComfyUI/custom_nodes
git clone https://github.com/kinorax/comfyui-info-prompt-toolkit.git
cd comfyui-info-prompt-toolkit
pip install -r requirements.txt
Installing via ComfyUI Manager is the easiest option.
Note:
SAM3 Prompt To Mask,PixAI Tagger, andOppaiOracle Taggerrequire manual placement of model files underComfyUI/modelsafter installation. See the relevant sections inCore Nodesfor details.
Support Ongoing Development
A paid note article is available for users who want polished results with less trial and error. It introduces production-oriented SDXL and Anima workflows built with these custom nodes. Purchasing the article helps support ongoing development.
Article: ComfyUI SDXL & Anima Workflow: Automatic Detailer, XY Plot, Caption File Generation, and More
The workflow files use English labels throughout.
Core Nodes
SamplerCustom (Sampler Params, Tiled) / SamplerCustom (Sampler Params)
- Accepts
sampler_paramsand performs sampling using the officialKSamplerSelect/BasicScheduler/SamplerCustomnodes (no custom sampling logic is implemented). - The Tiled version uses the same sampling settings as the standard version and runs inference by splitting into spatial tiles.
- The Tiled version is useful not only under VRAM constraints, but also when you need output resolutions beyond a model's practical supported size.
- Models with verified operation for the Tiled version are currently
SDXL (with ControlNet Tile)andAnima. Other models may still work, but compatibility is not guaranteed.
Sampler Params
- Aggregates sampler/scheduler/steps/denoise/seed/cfg into a single
sampler_paramsbundle. - Improves both wiring simplicity and configuration reuse.
XY Plot Start / XY Plot Modifier / XY Plot End
XY Plot Modifierchains axis-specific change sets (label+changes) as an array and defines X/Y condition variations.XY Plot Startapplies X/Y modifiers to the baseimage_info, generates per-cellimage_info, and outputs inlist(all at once) orloop(iterative) mode.XY Plot Endreceivesxy_plot_infoand generated images, then composes the axis-labeled grid imagexy_plot_image.- In
loopmode,StartandEndcooperate vialoop_controlto process all cells sequentially.
Image Info Context
Image Info Contextreconstructs updatedimage_infoby reflecting only the input fields that are actually connected.- When
positiveis connected, it extracts<lora:...:...>tags and applies the tag-removedpositivetext and extracted values tolora_stack. extrasis merged into existingimage_info.extras, and duplicate keys are overwritten by input-side values.- In addition to updated fields, it outputs
base_sampler_params(with fixeddenoise=1.0) for easy connection to downstream sampling nodes.
Image Info Fallback
Image Info Fallbackfills missing fields in the primaryimage_infofromimage_info_fallback.- Fallback is limited to missing fields, and fields that already have values in the primary side are not overwritten.
extrasis merged by adding only missing keys, while existing keys are preserved.lora_stackis supplemented when it is missing orNone; an explicit empty list means no LoRA and is preserved.
Detailer Start / Detailer End
Detailer Startdetects abounding box (bbox)from regions where the inputmaskvalue is greater than0.0, then creates an expanded processing region usingcrop_margin_scale.- The processing region is pre-upscaled by
upscale_factor, then rounded up to a size divisible bymini_unit(8/16/32/64) and arranged withcenter padding. - For compositing back into the original image, the graded values of the input
maskare preserved as asoft mask, and that information is stored indetailer_control. Detailer Endreceivesinpainted_imageandcomposites it back into the original image using the preservedsoft mask.- If
inpainted_imageresolution differs from the expectedcanvassize, it is automatically resized before restoration. - If no target region is detected,
Detailer Enddoes not evaluateinpainted_imageand returns the original image unchanged.
SAM3 Prompt To Mask
SAM3 Prompt To Maskis a single-purpose node that generates asoft maskfrom text prompts. Comma-separatedprompttokens are treated as OR conditions, and accepted results can be controlled withscore_thresholdandcombine_mode(union/top1).- The output is a non-binarized
soft mask; thresholding and region cleanup are intended to be handled by downstream nodes. - This node is designed with a strong focus on keeping additional
pip-installed dependencies to a minimum, because some existing SAM3-related extensions can significantly alter Python environments. - Under that policy, SAM3-related functionality is intentionally limited to this single purpose, and no further feature additions are planned at this time.
- Place
sam3.ptinComfyUI/models/sam3(download: facebook/sam3; operation with SAM3.1 and later is unverified).
PixAI Tagger
PixAI Taggerestimates tags from images and outputsgeneral/character/ip.- Tag selection uses
threshold_general/threshold_characterandmax_tags_general/max_tags_character. sort_ordercontrols the final display order forgeneraltags only (score/tag_id);characterandipare always output in score order.- This node runs on a PyTorch implementation and does not depend on
onnxruntime/onnxruntime-gpu, making the setup less susceptible to Python environment changes. - Place the PixAI Tagger v0.9 bundle (
model_v0.9.pth/tags_v0.9_13k.json/char_ip_map.json) inComfyUI/models/pixai_taggerorComfyUI/models/pixai_tagger/v0.9(download: pixai-labs/pixai-tagger-v0.9). - The previous released node remains available as
PixAI Tagger (Deprecated)for existing workflows.
OppaiOracle Tagger
OppaiOracle Taggerestimates tags from images and outputstags/rating.- Tag selection uses
thresholdandmax_tags;sort_ordercontrols only the final display order (score/tag_id). - This node runs on a PyTorch implementation and does not depend on
onnxruntime/onnxruntime-gpu, making the setup less susceptible to Python environment changes. - Place the OppaiOracle bundle (
model.safetensors/config.json/preprocessing.json/vocabulary.json) inComfyUI/models/oppai_oracle/V1.1orComfyUI/models/oppai_oracle/V1.0(download: Grio43/OppaiOracle).
Flatten Prompt for Caption / Merge Caption Tokens / Remove Caption Tokens
Flatten Prompt for Captionprepares prompt text for caption files by removing prompt emphasis syntax and weight values, then unescaping escaped parentheses and backslashes.Merge Caption Tokensmergesstartandendcaption token strings, removes duplicate tokens, and rebuilds the result as a single-line caption.- Caption tokens are split on
,and.. Existing order is preserved, and the first occurrence of each token is kept. Remove Caption Tokensremoves exact token matches fromstringusing the comma-separatedremoveinput, while preserving the remaining token order.- These nodes are useful when combining tagger output, handwritten captions, and prompt text before writing caption files.
Prompt Template
Prompt Templategenerates final prompts from template text. It handles////*...*/comment removal, wildcard expansion, Dynamic Prompts expansion, and$keyreplacement in one node.- Wildcards are loaded from
ComfyUI/user/info_prompt_toolkit/wildcards.txtfiles and support__name__(random) and__name__#N(fixed selection), including weighted lines inweight::valueformat. - Dynamic Prompts supports
{a|b}plus weighted options, multi-select, range selection, and the@cycle sampler. - When
seedis connected, random expansion becomes reproducible; without it, results are non-deterministic. - When
extrasis connected,$keyplaceholders are replaced while missing keys are left as-is.suffixis appended after template expansion. - Outputs include raw
stringand token-normalizednormalized_string.
Image Reader / Image Saver
Image ReaderandImage Saverare core nodes that support reusable workflows for images that retain generation data (A1111 infotext/image_info).Image Savercan save WebP or PNG images and embedsA1111 infotextinto matching image metadata so prompt, model, and multiple LoRA references remain reusable.Check Referenced Models...in theImage Readerright-click menu parses referenced entries from image infotext and lists Model / Refiner / Detailer / CLIP / VAE / LoRA items.- The same window also shows local availability for each reference (Present / Missing), and can jump to
View Model Info...for deeper inspection. Image Saversupports both automatic serial naming and explicitfile_stemnaming, so you can switch naming strategy by workflow.- When
write_captionis enabled, a same-name.txtcaption file is written alongside each image.
Referenced Image Saver
Referenced Image Savercopies an existing file supplied throughimage_referenceinto the ComfyUI output directory and rewrites its A1111 infotext metadata fromimage_infowithout re-encoding the image pixels.- It supports PNG / WebP / JPEG metadata updates and preserves the source extension, making it useful for saving lossy WebP or JPEG images again without further quality loss.
- When
file_stemis unconnected, it uses the same automatic serial naming asImage Saver. When connected, it saves as<file_stem><source extension>and overwrites an existing file with the same name. output_subdircan organize files by date, and enablingwrite_captionwrites a same-name.txtcaption alongside each image.
Image Directory Reader
Image Directory Readerloads multiple images from subdirectories under ComfyUIinput/outputand returns corresponding data as aligned list outputs.- You can choose the source with
path_sourceandpath(relative directory), then control the selection range withstart_indexandimage_load_limit(0= unlimited). - Target images are selected after case-insensitive filename sorting, making batch selection results easier to reproduce.
- For each image, it outputs
image,image_inforeconstructed and normalized from A1111 infotext, extensionless filenamefile_stem, and same-name.txtcaption(empty string when missing). - It also outputs
path_sourceandpath, so it can be connected directly toCaption File Saver.
Video Reader / Video Saver
Video ReaderandVideo Saverare a paired set of nodes that support video reuse workflows while retaining generation metadata (source_image_info/video_info).Video Readeroutputsimageas a list. If downstream nodes expect batch-oriented image input or do not assume list expansion, route throughImage List To Batch.- In
Video Saver, the activecrffield controls the quality/file-size tradeoff; lower values generally produce higher quality and larger files. source_image_infokeeps source-image information, whilevideo_infokeeps video-related information for easier review and comparison later.Video Reader/Video Saverare available in environments wherePyAV(av) is installed. Available codecs depend on the user's PyAV / FFmpeg build.
Mask Overlay Comparer
Mask Overlay Comparerdisplays a slider-based comparison between the originalimageand a mask-overlayed view, making mask coverage easier to inspect visually.- The comparer switches between two views: an easier-to-read background image and the image with mask overlay applied.
- The
maskis visualized without binarization, using raw values in the0.0..1.0range. - Visualization behavior is:
mask = 0.0keeps the image unchanged,mask = 1.0renders black, and intermediate values are shown as a blue-tinted overlay. - For preview generation, use
imageandmaskat the same resolution.
Aspect Ratio to Size
Aspect Ratio to Sizerecalculateswidth/heightfrom node-UI widget edits before execution, so you can adjust values while checkingactual_ratio.- It resolves size from
width_ratio : height_ratioand a base size, using eitherwidthorheightas the anchor and deriving the other side from the ratio. - The resolved size is aligned to
min_unit(8 / 16 / 32 / 64), which helps keep resolutions on practical step sizes. width x heightis a combined size output that carries width and height on a single line, making it easy to pass into nodes that accept size input.
Aspect Ratio to Size (Trim Margin) / Trim Image by Margin
Aspect Ratio to Size (Trim Margin)calculates a sampling size that extends beyond the desired image edges so thatTrim Image by Margincan remove the margins afterward. The horizontal and vertical margin pairs stay linked, with each pair totaling either zero ormin_unit. Its size outputs include all four margins and remain divisible bymin_unit.- Edit
actual_width/actual_heightas the size remaining after trimming. The readonlywidth/heightfields show the sampling size including margins, whileactual_ratiodescribes the trimmed size. - The
marginoutput bundlestop,right,bottom, andleftforTrim Image by Margin. Whenmarginis unconnected, the trim node passes the image through unchanged. Set Margin Extra/Get Margin Extrastore margins in image-info extras and restore both the bundled margin and its four edge values.
Load New Model / Use Loaded Model
Load New ModelandUse Loaded Modelare a paired workflow that separates model loading from model reuse.Load New Modelreceives the selected model from selector nodes such asCheckpoint SelectororDiffusion Model Selector. Checkpoint selections can loadmodel,clip, andvaefrom the checkpoint; diffusion model selections load themodeland use the optionalclip,vae, andvae_fallbackinputs for the accompanying CLIP/VAE runtime.- When the same CLIP configuration is used across diffusion models and the CLIP remains unmodified,
Load New Modelcan reuse the CLIP retained by aUse Loaded Modelbundle through a weak-reference index and avoid loading it again during model changes. Use Loaded Modelkeeps the final runtime bundle in a process-local cache keyed by the selected model, runtime settings,lora_stack,apply_lora_to_clip, and connectedclip/vaeconditions. On cache hit, the lazyloaded_model/loaded_clip/loaded_vaebranch is skipped.Use Loaded Modelapplieslora_stackinternally by default. Setapply_lora_to_clip=falseto apply it only to the model and keep CLIP reusable. Setapply_lora_stack=falseifloaded_modelandloaded_clipalready include the same external LoRA processing.- When placing
Lora Stack LoraderorTorchCompile-related nodes beforeUse Loaded Model, connect their final outputs to the lazy inputs and setapply_lora_stack=false.Lora Stack Loraderalso hasapply_lora_to_clip; for external processing, set the same option onUse Loaded Modelto describe the final CLIP state. - Cache behavior is configurable in
ComfyUI Settings > Info-Prompt-Toolkit > Use Loaded Model Cache.Autoalways keeps the latest entry and prunes older entries by estimated memory size andMemory budget ratio;Fixedkeeps up toMax cache entriesregardless of the memory budget.Max cache entriesdefaults to1and can be set from1to9. Use cache loggingprints cache hit / miss / store / evict / clear messages to the ComfyUI Python console, including estimated memory amounts for store and evict events.lora_stackmatching is order- and strength-sensitive, so changing order or values is treated as a different condition set.
Model Merge
Model Mergerecords twoIPT-Modelselections and their merge ratios in a newIPT-Modelvalue. It does not load or merge model weights immediately; the actual model runtimes are loaded and merged when the result is passed toLoad New Model.- Connect the result to the corresponding
model,refiner, ordetailerinput ofImage Info Contextor another image-info node to retain the complete merge configuration inimage_info, including both source model references, their model types, and the model / CLIP ratios. - When that
image_infois saved byImage Saveror another compatible saver, the configuration is serialized as JSON in the A1111 infotext metadata. Depending on itsimage_infofield, it is written asModel Merge,Refiner Merge, orDetailer Mergeinstead of being flattened into an ordinary single-model entry. - When the saved image is loaded by
Image Reader, the merge metadata is parsed back into the correspondingmodel,refiner, ordetailervalue inimage_info.Image Info Contextcan then output the restoredIPT-Modelvalue for reuse withLoad New Model. - The metadata stores the merge configuration, not the merged model weights. The referenced source model files must therefore be available locally when the configuration is loaded and executed again.
base_modelandmerge_modelmust both be checkpoints or both be diffusion models; mixing the two model types is not supported.model_ratiocontrols the model merge from the base model at0.0to the second model at1.0. For checkpoints,clip_ratioindependently controls the CLIP merge over the same range.- Checkpoint merges retain the VAE from
base_model. For diffusion models,clip_ratiois ignored and CLIP / VAE can be supplied toLoad New Modelas needed.
Release Memory
Release Memoryreleases selected persistent runtime references and requests Python / CUDA cleanup after the step connected toafterhas completed.- The
afterinput andthenoutput are pass-through sockets, so the node can be placed near the end of a workflow without changing the data being passed onward. Generation Runtimeunloads ComfyUI generation models where possible and clears this extension'sUse Loaded Modelcache and recently loaded VAE runtime.SAM3 Runtimeclears the SAM3 Prompt To Mask processor cache, whileTagger Runtimeclears PixAI Tagger and OppaiOracle Tagger torch model caches.GC & CUDA Cleanupruns garbage collection and asks the available CUDA cleanup hooks to release allocator-held memory where possible.- The
Release Nowbutton performs the same cleanup manually when no prompt is currently running.
Selector Nodes
- Selector nodes centralize choices for reusable workflow inputs such as checkpoints, diffusion models, LoRAs, CLIP models, VAEs, samplers, and schedulers.
- Model-related selectors include
Checkpoint Selector,Diffusion Model Selector,Unet Model Selector,Lora Selector,Power Lora Selector,Vae Selector,CLIP Selector,Dual CLIP Selector,Triple CLIP Selector, andQuadruple CLIP Selector. - Supported model-related selectors provide a right-click
View Model Info...action that uses the selected asset's SHA256 as a key to fetch metadata from Civitai and display it in a model information window. - For
Lora Selector,View Model Info...can also show a LoRA tag list with tag frequencies when metadata has been analyzed for the selected LoRA. Power Lora Selectorbuilds a LoRA stack from any number of rows; each row provides ON/OFF, LoRA, strength, model information, and removal controls.- Common connection targets include
Image Info Defaults,Image Info Context,Load New Model,Use Loaded Model, andXY Plot Modifier.
Example Workflows
Save Images With Metadata Using Image Saver
Use Image Saver at the end of a generation workflow to save images with reusable metadata. The embedded A1111 infotext / image_info keeps prompt, model, LoRA, sampler, and related settings available for later reuse.
Generate From Metadata Loaded by Image Reader
Load a metadata-rich image with Image Reader, pass the restored image_info into the workflow, and generate from the saved settings as a starting point for reproduction or further iteration.
Filter and Encrypt Metadata Before Saving With Referenced Image Saver
Load an existing image with Image Reader, remove selected main fields and extra keys from its image_info, specify which remaining fields to encrypt, and save the result with Referenced Image Saver. This lets you choose which metadata is removed, kept public, or stored in encrypted form without re-encoding the image pixels.
License
- The original source code of this project is offered under GPL-3.0-or-later.
- This repository also includes vendored
sam3, which is distributed under the SAM License. - See THIRD_PARTY_LICENSES.md for third-party license details, including notes on separately obtained optional models.
- Model files and other external assets obtained separately by users remain subject to their respective upstream licenses and terms.
























