python and web UX improvements for ComfyUI: Lora/Embedding picker, web extension manager (enable/disable any extension without disabling python nodes), control any parameter with text prompts, image and video viewer, metadata viewer, token counter, comments in prompts, font control, and more! [w/'ImageFeed.js' from the custom scripts of pythongosssss is not compatible with this suite's ImageDrawer feature. Additionally, 'DynamicPrompts.js' and 'EditAttention.js' from the core, along with 'favicon.js' from the custom scripts of pythongosssss, are incompatible with advanced features of the suite. Please use the JNodes Extension Management setting in Settings > JNodes > Extension Management to disable these extensions by unchecking them to use the full functionality of the suite.]
python and web UX improvements for ComfyUI:
Lora/Embedding picker
web extension manager (enable/disable any web extension without disabling python nodes)
control any parameter with text prompts
image and video viewer, metadata viewer
token counter
comments in prompts
font control, and more!
thank you to:
Free, open-source software (FOSS) donations are my only source of income. If this suite has helped you at all, please consider donating:
EditAttention improvements (undo/redo support, remove spacing)
Status (progress) indicators (percentage in title, custom favicon, progress bar on floating menu)
Font control for textareas (see ComfyUI settings > JNodes)
Batch Commenting shortcuts: By default, click in any multiline textarea and press ctrl+shift+/ to comment out a line or lines, if highlighted. Requires the use of a JNodes_RemoveCommentedText node. The key combo and the text used to comment are both configurable in ComfyUI settings > JNodes.
In this example, the headings enclosed in "##" like "## Basic stuff ##" are commented out entirely. In the line "(worst quality, low quality:1.1), ## Works well sometimes, don't go above 1.3 or it will burn. Kills backgrounds ##", "(worst quality, low quality:1.1)," would be used while everything else would be commented out. In another line, "# deformed" would be commented out entirely because it's a single "#" at the beginning of the line. Note the node's fields corresponding to the text itself.
Pan faster around the graph by holding ctrl+shift and moving the mouse.
Clone this repo into "ComfyUI/custom_nodes" OR
Install via ComfyUI Manager (search "JNodes") OR
Download the zip file and unzip it into "ComfyUI/custom_nodes"
Open ComfyUI Settings by clicking the "Cog" icon on the floating toolbar and scroll down to "JNodes Settings." Expand the group by clicking the side-facing arrow beside the text.
Batch-commenting Hotkey: A key combo that, when pressed, will insert text at the beginning of the selected lines in a multiline textarea, assuming it is the active element. If no text is selected, the text will be inserted at the beginning of the line where the cursor currently sits. This text will not automatically dummy out any lines, you will need to pass the resulting text into a custom node that removes lines marked as 'commented'.
Batch-commenting Token: The token that will be inserted/removed when performing a batch comment operation
Extension Management: Deselect any unwanted web extensions to disable them. Select them again to re-enable them. Refresh your browser to see changes. Be extremely careful which extensions you disable.
Image Drawer Anchor: To which part of the screen the screen the drawer should be docked
Image Drawer Enabled: Toggle whether the drawer is enabled. Requires a page refresh. This is distinct from hiding the drawer - this stops the drawer code from loading entirely until re-enabled.
Image Drawer Image & Video Key List Allow/Deny Toggle: Whether the terms listed in the Key List should be denied or allowed, excluding everything else. True = Allow list, False = Deny list.
Image Drawer Image & Video Key List: A set of comma-separated names to include or exclude from the tooltips applied to images in the drawer. For example, we don't show the "prompt" or "workflow" values by default since they would be too lengthy.
Image Drawer Image & Video Metadata Tooltip Toggle: Whether to show a tooltip with metadata when hovering images and videos in the drawer.
Multiline Text Font Family: A typeface applied to all multiline text areas in the graph.
Multiline Text Font Size (%): How large, as a percentage, the text in multiline text areas should be.
Show Progress Bar Above menu: If true, a progress bar for the current node will be displayed above the Comfy floating menu.
Show Progress in Title: If true, display progress for the current node in the title/tab of the browser, similar to Automatic1111.
Use Custom Favicon: If true, display a custom favicon in the title/tab of the browser. Stored in "ComfyUI/custom_nodes/ComfyUI-JNodes/web/js/assets/", "favicon.ico" is used when a generation is not in progress while "favicon-active.ico" is used when one is.
Similar to pythongosssss's ImageFeed, but with a larger feature set. Searchable. Change Contexts with the Context Selector. Mouse over images in drawer to see exif/png_info.
On the top left of the drawer, find:
A "Hide" button (❌) that "closes" the drawer. It can be restored with the "Image" button (🖼️) next to the ComfyUI Settings "Cog" button on the floating toolbar.
The View Options flyout allows you to control how many images appear in a row and how large those images apppear. You can adjust them via sliders or click each underlined name to set a number directly. You'll also find a place to adjust the drawer's anchor point so you can adjust it to a position that feels comfortable for you.
The "Sync" button (🔄) which will restart all playing videos so that they may sync up better.
On the top right you'll find:
Context Selector: Allows you to select different contexts to show different images, videos and models. See Contexts.
Sort Type: Different contexts have different ways of being sorted, such as Date (file age), file size, filename, etc. Not all contexts support all sort types, so they will change between shifting of contexts. Of note is the Shuffle type. Shuffle will semi-randomly sort items in the list and enables a button (🔀) beside the Sort Type dropdown. Click it to shuffle again. Click and hold to set an automatic shuffle every x milliseconds. When in auto mode, click the button again or change the sort type to stop shuffling automatically.
Search bar: A search filter for for items in the list, crawling metadata and filename. For generated images you can search for prompts and other parameters. For models you can search for civit.ai info. For everything else you can search for filename, subdirectory, and other things. Items that don't meet the criteria are temporarily hidden. You can clear the search (❌), swap between matching ALL search tokens or matching ANY of the search tokens (separated by space), or randomize search tokens (🎲).
Context Toolbar: Here you can find controls specific to the currently selected context. See Contexts for more information about the controls in each toolbar.
ContextSubdirectoryExplorer is a context type that displays the images and videos in a specific directory.
When one of these contexts is selected, the "root" directory's images are loaded first, but you can select any child directory using the subdirectory selector below the search field.
You can load all of the images and videos in the child directories of the current subdirectory by clicking "Include subdirectories", but be careful - it's dependent on your system, but trying to load too many images could cause a hard lock or out-of-memory errors if you run out of RAM. VRAM is managed by the drawer, but system RAM is not. This option is automatically disabled when switching subdirectories for safety.
A flyout of video options sits beside the "Include Subdirectories" checkbox - hover over it to reveal some controls for video playback such as autoplay, looping, control visibility, muting, volume, and playback rate. There's also the option to seek through videos using the mouse wheel, but this can be disabled through this menu if you don't like this function.
The Refresh button can be used to reload the current set of images and videos in case some are added or removed outside of the drawer's interface.
The Jump button at the end can be used to automatically scroll to the top of the list of images and videos.
Mouse over any image or video in the list to see metadata in a tooltip as well as a couple of controls listed below. Metadata tooltips can be disabled in JNodes Settings.
The filename, which when hovered will display file information like its subdirectory, file size, dimensions, and, if available, fps, frame count and duration.
A control to recycle/delete the item.
A control to remove the item from the current view which will be restored when refreshing the context list view.
A control to open the containing directory
A control for each item in the metadata that can be copied
_The metadata tooltip appears when hovering over an image and shows all key-value pairs except those blocked in JNodes Settings
The overflow menu toolbutton displays controls relating to this individual image and its metadata
The image on the left is selected which causes the batch deletion/removal buttons to appear. The batch selection button now displays 1 item is selected.
Images and videos can be dragged and dropped onto any JNodes_UploadVisualMedia node. Note that at this time it is not possible to drop them onto a comfy LoadImage node.
ContextModel is a context type similar to ContextSubdirectoryExplorer but for loras and embeddings (lora picker/embeddings picker). There is no subdirectory selection support - all models within subdirectories are automatically found along with their images and info files if they are named similarly.
The model cards can have their aspect ratio edited using the toolbar.
The Refresh button can be used to reload the current set of models and images in case some are added or removed.
The Jump button at the end can be used to automatically scroll to the top of the list.
Each card displays an image relating to the model and these images can be switched by clicking the left/right arrows (if multiple images exist relting to a given model). The top right of the card displays a number corresponding to the image currently being viewed.
The bottom of each card displays the friendly name (defined by the info file) and the model's actual filename as well as some tags defined by the model's info file. Click these tags to find other models with similar tags.
On the top left you can find controls relating to the model defined in the model's info file, if applicable. From right to left:
Screencast_20240609_163155.webm
Screencast_20240609_162805.webm
Image Ouput Nodes
Parameter List Nodes
Prompting Nodes
JNodes_TokenCounter: Count tokens in a given string based on the currently loaded model(s).
JNodes_AddOrSetMetaDataKey, JNodes_SetPositivePromptInMetaData, JNodes_SetNegativePromptInMetaData, JNodes_RemoveMetaDataKey: png_info manipulation nodes targeting a1111-style png_info
JNodes_SyncedStringLiteral: a multiline text node synced with external text files. Put the path in the "path_to_synced_txt" field and save/load from it.
JNodes_RemoveParseableDataForInference: Removes parameters from input text so the text alone can be used for inference.
JNodes_ParseDynamicPrompts: Yet another dynamic prompts implementation with randomization controls
JNodes_ParseWildcards: Yet another Wildcards implementation with some extra options like randomization control.
JNodes_RemoveCommentedText: just add # decorator before each line you want to be ignored or encapsulate specific text on a line with ## on either side "## Commented text ##". Decorator is configurable.
JNodes_SplitAndJoin: Splits input text and rejoins each item with a delimiter. Great for removing extraneous spaces and commas from a display prompt.
JNodes_TrimAndStrip: Simply removes whitespace from the head and tail of the given text.
JNodes_SearchAndReplace, JNodes_SearchAndReplaceFromList, JNodes_SearchAndReplaceFromFile: Search and replace text in any text, intended for prompts to change certain trigger words, for example an embedding named '3mb3dd1n4' can be changed to 'embedding'. The replacement words can come from a muiltline text or a text file (one per line, ex. 3mb3dd1n4->embedding) or can be entered directly.
Selector Nodes (Can be randomized based on seed (e.g. to select a random checkpoint name) and will return the value as a string)
Media Nodes
JNodes_MediaInfoToString: Format [MediaInfo] as a string. See JNodes_BreakMediaInfo for more information on the MediaInfo structure.
JNodes_AppendReversedFrames: Takes in frames as an "IMAGE" pin and reverses them, then appends them. Creates a ping-pong style looped "video".
JNodes_UploadVisualMedia: Similar to Comfy's LoadImage, but works for images and videos and returns a path to the uploaded media. The path should then be plugged into a node like JNodes_LoadVisualMediaFromPath. You can also select where to upload the media, either to "temp" or "input" "/upload_media". Below the preview image is formatted metadata loaded from the image or video. You can drag images from the ImageDrawer onto this node or drag them in from your file explorer.
JNodes_LoadVisualMediaFromPath: Given a path to an image or video, will output all frames as an "IMAGE" pin. Start point ("start_at_n") and number of frames ("sample_next_n") can be specified, as well as whether to deal in frames or a number of seconds ("start_at_unit", "sample_next_unit"), so if you know you want 16 frames starting 3 seconds into a video, you can mix and match. A "sample_next_n" value of 0 means to get all remaining frames after "start_an_n". Can also skip a number of frames every cycle (to lighten the workload) and discard transparency. Other outputs are MediaInfo outputs, one for the original media and one for the output images. See JNodes_BreakMediaInfo for more information on the MediaInfo structure.
JNodes_BreakMediaInfo: Get the individual components of the MediaInfo structure:
Example:
Misc Nodes
JNodes includes a feature that allows for text parameters in prompts. With this feature you can add something like <params: image_size_y: 512> to your text prompt to make your image have a height of 512. Anything can be parameterized including model names, numbers, even booleans. That means you can have different parameters for individual prompts. Imagine that you normally like to generate images at 512x768 but you want to do an XL generation. Instead of manually changing the latent size to 1024x1024, you can simply add <params: image_size_x: 1024> <params: image_size_y: 1024> to your prompt.
This is not exactly automatic though, and requires some manual set up the first time.
In this example, we have a JNodes_GetParameterFromList node with a random seed (from the rgthree suite) plugged into parameter_default. This means that if we don't specify a parameter in parameter_list, we will use the random seed. Hooked into parameter_list is the current prompt which does specify a seed with "params:seed:8675309" meaning we will use this number instead of the randomly generated one from the default input. The parsing_key and parameter_name fields match up with the prompt's parameter and return type is "auto" which means it will be automatically converted to the correct type (number) Finally, note that we plug the prompt into a JNodes_RemoveParseableDataForInference node before being passed into the CLIP Conditioning happens. This removes instances of parameters from the text like "params:seed:8675309". You do not need to make a new parameter list for every parameter, you can put them all in the same single prompt.
There are some incompatibilities with some Comfy extensions and some popular extensions. They can be optionally disabled with this suite. Please use the JNodes Extension Management setting in Settings > JNodes > Extension Management to disable the following extensions by unchecking them:
pysssss.ImageFeed is disabled by default. You can disable all of these extensions in one click by clicking the "Disable Recommended Extensions" button and refreshing the page.
Your data is your own. This suite of nodes and web features does not collect any data from you or your machine.