Skip to content

fix: Image grid bug fix (CORE-215)#14100

Open
yousef-rafat wants to merge 2 commits into
Comfy-Org:masterfrom
yousef-rafat:master
Open

fix: Image grid bug fix (CORE-215)#14100
yousef-rafat wants to merge 2 commits into
Comfy-Org:masterfrom
yousef-rafat:master

Conversation

@yousef-rafat
Copy link
Copy Markdown
Contributor

this contains handling for batched images for the image grid node
it unpacks batched images and batched images inside lists and tuples
before and after images are below
Screenshot 2026-05-25 154713
Screenshot 2026-05-25 154859

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds image input normalization to ImageProcessingNode. A new _ensure_image_list classmethod converts 4D tensors into a flat list of 3D image tensors, wraps 3D tensors as single entries, and flattens list/tuple inputs containing 4D tensors. ImageProcessingNode.execute now calls this helper when is_group is true before extracting parameters and calling _group_process.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description explains the purpose of the changes (handling batched images for the image grid node), includes before/after screenshots demonstrating the fix, and is directly related to the code changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title 'fix: Image grid bug fix' is somewhat redundant but directly relates to the PR's main objective of fixing the image grid node's handling of batched images.

✏️ 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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@comfy_extras/nodes_dataset.py`:
- Line 463: The call to cls._ensure_image_list(images) forces images to a list
and breaks the single-image contract of _process; restore the original interface
by only normalizing to a list for batch processing or, if mode is
"individual"/single, pass a single image into _process (e.g., detect
original_is_list = isinstance(orig_images, list) or check the node's mode
variable, call cls._ensure_image_list only when batch, or if already converted
call _process(images[0]) and return a single result), and ensure _process,
_ensure_image_list and any dispatch logic around images preserve the original
input type/return semantics.
- Around line 409-415: The current flattening loop over images only unwraps one
level and lets nested lists/tuples through; update the function containing this
code to recursively traverse nested list/tuple items (detect collections via
isinstance(item, (list, tuple))) and flatten them fully: if an item is a
list/tuple, recurse into it; if it is a torch.Tensor and item.ndim == 4, extend
flat with each sample item[i]; otherwise append the tensor or scalar. Keep the
existing torch.Tensor and ndim==4 handling (the variables images, flat, and
item) but replace the non-recursive loop with a small recursive helper or
stack-based iteration to ensure no nested containers leak into the returned flat
list.
🪄 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: a0147ade-3201-422d-8ec6-47b677a4c349

📥 Commits

Reviewing files that changed from the base of the PR and between 0077d78 and 1d0b024.

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

Comment thread comfy_extras/nodes_dataset.py
Comment thread comfy_extras/nodes_dataset.py Outdated
@alexisrolland alexisrolland changed the title image grid bug fix image grid bug fix (CORE-215) May 25, 2026
@alexisrolland alexisrolland changed the title image grid bug fix (CORE-215) fix: Image grid bug fix (CORE-215) May 25, 2026
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