diff --git a/README.md b/README.md index df07401..0d303e8 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ It includes: - **Prompt Machine:** Easy prompt selection from a CSV for positive/negative prompt workflows. - **Touchpad Pan & Zoom:** Seamless navigation for large images in the ComfyUI preview panel. - **Resolution Machine:** Quick selection of model-specific image resolutions for popular models. +- **Save Image w/Metadata:** saving images with meta data and with different file formats. --- @@ -100,29 +101,31 @@ It includes: --- -### Prompt Machine +### 💬 Prompt Machine + +Loads positive and negative prompts from a `prompts.csv` file, allowing you to quickly switch between predefined prompt sets in your workflow. | Name | Type | Description | |-------------|--------|------------------------------------| | `selection` | STRING | Prompt set name from CSV | **Outputs:** - | Name | Type | Description | |-------------|--------|------------------------------------| | `positive` | STRING | Positive prompt | | `negative` | STRING | Negative prompt | --- - -### Touchpad Pan & Zoom - -- **No node configuration required.** -- Enables pan/zoom in the ComfyUI preview panel for large images. + +### 🖱️ Touchpad Pan & Zoom + +A UI enhancement that enables smooth, intuitive touchpad-based panning and zooming on images in the ComfyUI preview panel. No node configuration is required—it works automatically. --- -### Resolution Machine +### 📏 Resolution Machine + +Provides dropdowns to quickly select recommended resolutions for popular models like SDXL, Pony, SD3, and more. Selecting a preset auto-populates width and height, but you can also set them manually. | Name | Type | Description | |--------------|--------|--------------------------------------------------| @@ -132,38 +135,31 @@ It includes: | `height` | INT | Image height (can be set manually) | **Outputs:** - | Name | Type | Description | |----------|------|----------------------------| | `width` | INT | Final image width | | `height` | INT | Final image height | --- + +### 💾 Save Image w/Metadata + +An advanced image saving node with dynamic pathing, metadata embedding, and filename collision avoidance. -### 💾 Save Image w/Metadata — Inputs & Outputs - -| Name | Type | Description | -|--------------------|---------|-------------| -| `path_and_filename`| STRING | Single required path + filename string. Examples: `comfy`, `Test/comfy`, `SDXL/Test/comfy`. The last segment is used as filename (extension ignored); preceding segments are folder path under ComfyUI output directory. | -| `extension` | STRING | File format dropdown: `png`, `jpeg`, `webp`. | -| `custom_string` | STRING | Optional custom text to embed in metadata. | -| `quality_jpeg_or_webp` | INT | JPEG/WEBP quality (1-100). | -| `lossless_webp` | BOOLEAN | If true, WEBP will be saved lossless (when supported). | - -**Hidden inputs:** - -- `prompt` — a dict-like object the node will consult to resolve `%...%` placeholders used in the `path_and_filename` string (best-effort lookup). - -**Outputs:** - -The node returns no tensor outputs but updates the UI with the list of saved filenames and their subfolders (so ComfyUI will display the saved files in the results panel). - -**Behavior notes & examples:** - -- If `path_and_filename` is `comfy` and `extension` is `png`, the node saves `OUTPUT_DIR/comfy.png` (or `comfy_0001.png` if it already exists). -- If `path_and_filename` is `SDXL/Test/comfy`, the node creates `OUTPUT_DIR/SDXL/Test/` if missing and saves `comfy.` inside it. -- You may use placeholders in `path_and_filename`, for example `%title%/img`, which will be resolved from the `prompt` dict when possible. - +| Name | Type | Description | +|------------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `path_and_filename` | STRING | Path and filename string (e.g., `MyRenders/character`). The last segment is the filename; preceding segments are folders under the ComfyUI `output` directory. | +| `extension` | STRING | File format: `png`, `jpeg`, `webp`. | +| `custom_string` | STRING | Optional custom text to embed in metadata. | +| `quality_jpeg_or_webp` | INT | Quality for JPEG/WEBP formats (1-100). | +| `lossless_webp` | BOOLEAN | If true, saves WEBP files losslessly. | +| `prompt` (hidden) | DICT | Workflow data used to resolve `%...%` placeholders in the filename (e.g., `%sampler_name%`). | + +**Key Behaviors:** +- **Dynamic Paths:** Automatically creates any missing folders in your specified path. +- **Metadata:** Embeds workflow data into PNG (tEXt), JPEG (EXIF), and WEBP (EXIF) files. +- **Collision Safe:** Prevents overwrites by appending a number (e.g., `image_0001.png`) if the filename already exists. +- **UI Output:** Returns a list of saved files to the ComfyUI manager/preview panel. ## 📝 License diff --git a/__init__.py b/__init__.py index 6904191..9051ba9 100644 --- a/__init__.py +++ b/__init__.py @@ -1,22 +1,28 @@ -from .nodes.upscale_machine import Upscale_Machine +# __init__.py + +# Import all the node classes from the nodes directory from .nodes.prompt_machine import Prompt_Machine from .nodes.resolution_machine import Resolution_Machine from .nodes.save_image_metadata import ImageSaveWithMetadata +from .nodes.upscale_machine import Upscale_Machine +# A dictionary that maps class names to class objects NODE_CLASS_MAPPINGS = { - "Upscale_Machine": Upscale_Machine, "Prompt_Machine": Prompt_Machine, "Resolution_Machine": Resolution_Machine, - "Save_Image_Metadata": ImageSaveWithMetadata, + "ImageSaveWithMetadata": ImageSaveWithMetadata, + "Upscale_Machine": Upscale_Machine, } +# A dictionary that maps display names to class names NODE_DISPLAY_NAME_MAPPINGS = { - "Upscale_Machine": "Upscale Machine", - "Prompt_Machine": "Prompt Machine", - "Resolution_Machine": "Resolution Machine", - "Save_Image_Metadata": "Save Image Metadata", + "Prompt Machine": "Prompt_Machine", + "Resolution Machine": "Resolution_Machine", + "Save Image w/Metadata": "ImageSaveWithMetadata", + "Upscale Machine": "Upscale_Machine", } -WEB_DIRECTORY = "./web" +# A dictionary that contains web directory information +WEB_DIRECTORY = "./js" -__all__ = ["WEB_DIRECTORY", "NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"] \ No newline at end of file +__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS', 'WEB_DIRECTORY'] diff --git a/prompts/lora.csv b/asset/loras.csv similarity index 100% rename from prompts/lora.csv rename to asset/loras.csv diff --git a/prompts/models.csv b/asset/models.csv similarity index 100% rename from prompts/models.csv rename to asset/models.csv diff --git a/prompts/prompts.csv b/asset/prompts.csv similarity index 100% rename from prompts/prompts.csv rename to asset/prompts.csv diff --git a/resolutions.json b/asset/resolutions.json similarity index 100% rename from resolutions.json rename to asset/resolutions.json diff --git a/prompts/styles.csv b/asset/styles.csv similarity index 73% rename from prompts/styles.csv rename to asset/styles.csv index 636350e..6368d10 100644 --- a/prompts/styles.csv +++ b/asset/styles.csv @@ -34,3 +34,16 @@ Space Hologram,"hologram floating in space, a vibrant digital illustration, drib Cute Creatures,"3d fluffy, closeup cute and adorable, cute big circular reflective eyes, long fuzzy fur, Pixar render, unreal engine cinematic smooth, intricate detail, cinematic",, Realistic Photo Portraits,"RAW candid cinema, 16mm, color graded portra 400 film, remarkable color, ultra realistic, textured skin, remarkable detailed pupils, realistic dull skin noise, visible skin detail, skin fuzz, dry skin, shot with cinematic camera",, Professional Scenic Photographs,"long shot scenic professional photograph of {prompt}, perfect viewpoint, highly detailed, wide-angle lens, hyper realistic, with dramatic sky, polarizing filter, natural lighting, vivid colors, everything in sharp focus, HDR, UHD, 64K",, +"Cotton, Fine","{prompt} in fine cotton fabric, highly detailed, gorgeous, matte fabric","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", +"Cotton, Regular","{prompt} dress in heavy knit cotton fabric, matte fabric, gorgeous cloth, highly detailed, cinematic","wrinkles, linen, seethrough, transparent, anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", +Denim,"{prompt} in heavy japanese (denim fabric), highly detailed, hard drape","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", +"Flannel, Brushed","{prompt} in soft woven brushed flannel, highly detailed, fuzzy flannel cloth, cashmere flannel","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", +Latex/Plastic,"{prompt} dress in shiny latex plastic material, expensive exquisite latex fabric, tight fitting","metallic, nude, naked, fabric wrinkles, anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", +"Latex/Plastic, Glossy","{prompt} in shiny wet glossy latex material, hard lighting, expensive exquisite latex fabric, tight fitting","metallic, nude, naked, fabric wrinkles, anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", +Leather,"{prompt} in smooth thin leather, highly detailed, expensive exquisite leather","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", +Linen,"{prompt} in linen fabric, loosely woven, gorgeous cloth, highly detailed","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", +Silk,"{prompt} in silk cloth, highly detailed, gorgeous, sheen lustre","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", +Velvet,"{prompt} in smooth velvet fabric, gorgeous exquisite cloth, highly detailed, fuzzy velvet cloth, expensive","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", +"Wool, Fine knit","{prompt} in wool cloth, highly detailed, gorgeous, fine knit cashmere wool fabric","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", +"Wool, Heavy knit","{prompt} in chunky heavy wool yarn, highly detailed, heavy knit large wool fabric, sailor's wool","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", +"Wool, Cable knit","{prompt} in chunky heavy cable knit wool yarn, highly detailed, cable knit large wool fabric","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", diff --git a/web/prompt_machine.js b/js/prompt_machine.js similarity index 100% rename from web/prompt_machine.js rename to js/prompt_machine.js diff --git a/web/resolution_machine.js b/js/resolution_machine.js similarity index 100% rename from web/resolution_machine.js rename to js/resolution_machine.js diff --git a/web/touchpad_pan_zoom.js b/js/touchpad_pan_zoom.js similarity index 100% rename from web/touchpad_pan_zoom.js rename to js/touchpad_pan_zoom.js diff --git a/nodes/prompt_machine.py b/nodes/prompt_machine.py index b9de595..b1aadb3 100644 --- a/nodes/prompt_machine.py +++ b/nodes/prompt_machine.py @@ -5,7 +5,7 @@ from server import PromptServer from aiohttp import web # Directory for CSV files (adjust if needed) -CSV_DIR = os.path.join(os.path.dirname(__file__), "..", "prompts") +CSV_DIR = os.path.join(os.path.dirname(__file__), "..", "asset") def list_csv_files(): try: diff --git a/nodes/resolution_machine.py b/nodes/resolution_machine.py index 7e0f241..80bdfe2 100644 --- a/nodes/resolution_machine.py +++ b/nodes/resolution_machine.py @@ -7,7 +7,7 @@ NODE_NAME = "Resolution_Machine" # Path to JSON config (root of SATA_UtilityNode folder) CONFIG_PATH = os.path.join( - os.path.dirname(os.path.dirname(__file__)), "resolutions.json" + os.path.dirname(os.path.dirname(__file__)), "asset","resolutions.json" ) def load_config(): diff --git a/prompts/clothing.csv b/prompts/clothing.csv deleted file mode 100644 index ff09854..0000000 --- a/prompts/clothing.csv +++ /dev/null @@ -1,14 +0,0 @@ -name,positive,negative,note -"Cotton, Fine","{prompt} in fine cotton fabric, highly detailed, gorgeous, matte fabric","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", -"Cotton, Regular","{prompt} dress in heavy knit cotton fabric, matte fabric, gorgeous cloth, highly detailed, cinematic","wrinkles, linen, seethrough, transparent, anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", -Denim,"{prompt} in heavy japanese (denim fabric), highly detailed, hard drape","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", -"Flannel, Brushed","{prompt} in soft woven brushed flannel, highly detailed, fuzzy flannel cloth, cashmere flannel","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", -Latex/Plastic,"{prompt} dress in shiny latex plastic material, expensive exquisite latex fabric, tight fitting","metallic, nude, naked, fabric wrinkles, anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", -"Latex/Plastic, Glossy","{prompt} in shiny wet glossy latex material, hard lighting, expensive exquisite latex fabric, tight fitting","metallic, nude, naked, fabric wrinkles, anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", -Leather,"{prompt} in smooth thin leather, highly detailed, expensive exquisite leather","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", -Linen,"{prompt} in linen fabric, loosely woven, gorgeous cloth, highly detailed","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", -Silk,"{prompt} in silk cloth, highly detailed, gorgeous, sheen lustre","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", -Velvet,"{prompt} in smooth velvet fabric, gorgeous exquisite cloth, highly detailed, fuzzy velvet cloth, expensive","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", -"Wool, Fine knit","{prompt} in wool cloth, highly detailed, gorgeous, fine knit cashmere wool fabric","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", -"Wool, Heavy knit","{prompt} in chunky heavy wool yarn, highly detailed, heavy knit large wool fabric, sailor's wool","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted", -"Wool, Cable knit","{prompt} in chunky heavy cable knit wool yarn, highly detailed, cable knit large wool fabric","anime, graphic, text, painting, crayon, graphite, glitch, cartoon, ugly, deformed, noisy, blurry, distorted",