Skip to content

feat: add overwrite/increment to SaveImageTextDataSetToFolderNode#13215

Open
zeerd wants to merge 3 commits intoComfy-Org:masterfrom
zeerd:master
Open

feat: add overwrite/increment to SaveImageTextDataSetToFolderNode#13215
zeerd wants to merge 3 commits intoComfy-Org:masterfrom
zeerd:master

Conversation

@zeerd
Copy link
Copy Markdown

@zeerd zeerd commented Mar 29, 2026

and SaveImageDataSetToFolderNode

The nodes SaveImageTextDataSetToFolderNode/SaveImageDataSetToFolderNode will overwrite old pictures and keep the latest one.
But, usually, we need to create few pictures then choose the better one.

So , we need a increment option.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c7579e4c-8767-48a0-bc59-c486bccc0cc2

📥 Commits

Reviewing files that changed from the base of the PR and between 8c6953d and 0120eb6.

📒 Files selected for processing (1)
  • comfy_extras/nodes_dataset.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • comfy_extras/nodes_dataset.py

📝 Walkthrough

Walkthrough

The changes add an overwrite parameter (default True) to save_images_to_folder, selecting between deterministic {prefix}_{idx:05d}.png naming (overwrite=True) and counter-based {resolved_prefix}_{counter:05}_{idx:05d}.png naming (overwrite=False) via folder_paths.get_save_image_path(). Two nodes, SaveImageDataSetToFolderNode and SaveImageTextDataSetToFolderNode, gain a mode combo (overwrite/increment), thread it through their execute signatures, extract the scalar, and pass mode == 'overwrite' into save_images_to_folder.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main feature being added: an overwrite/increment option to the SaveImageTextDataSetToFolderNode (and SaveImageDataSetToFolderNode, as clarified in the description).
Description check ✅ Passed The description explains the problem (overwriting old pictures) and the solution (adding an increment option), which directly relates to the changeset that adds overwrite/increment modes to both dataset saving nodes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@comfy_extras/nodes_dataset.py`:
- Around line 231-245: The nodes SaveImageDataSetToFolderNode and
SaveImageTextDataSetToFolderNode were made to require mode, breaking existing
callers; update their execute(cls, ...) implementations to treat mode as
optional by defaulting missing/empty values to "overwrite" (e.g., if not mode or
not mode[0], set mode = "overwrite" before using it) and also adjust the
io.Combo.Input declaration to allow an omitted value (keep the options but make
the input optional or provide a default of "overwrite") so existing node call
shapes continue to work.
- Around line 199-200: The code is wrongly deriving width/height from
img_tensor[0] and mutating prefix, causing incorrect %width%/%height% resolution
and prefix reuse; update the save path logic in the block that calls
folder_paths.get_save_image_path so it uses the actual PIL image size (use
img.size to get (W,H) or (width,height) appropriately) rather than
img_tensor[0].shape, and do not overwrite the incoming prefix—store the result
of get_save_image_path in a new local (e.g., resolved_prefix or resolved_paths)
and then build filename as f"{resolved_prefix}_{counter:05}_{idx:05d}.png" so
each image in the batch gets the correct dimensions and unique prefix.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2f304509-88de-4224-ae4a-6199dd0ae5f2

📥 Commits

Reviewing files that changed from the base of the PR and between fc1fdf3 and 8c6953d.

📒 Files selected for processing (1)
  • comfy_extras/nodes_dataset.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant