Skip to content

Conversation

@DustyShoe
Copy link
Contributor

Summary

This PR introduces a new feature: Extract Masked region as Raster Layer.

The feature allows users to extract the portion of all visible raster layers that falls within the painted Inpaint Mask. The extracted region is composited and added as a new raster layer. Compared to my previous attempt, is not limited to bbox and uses mask layer bounds.

The new raster layer is currently created at the top of the raster layer stack.
In an ideal workflow, it could appear directly above the active raster layer, but Invoke currently supports only one active raster layer at a time. Changing this behavior may introduce unnecessary complexity; maintainers may consider it separately.

Related Issues / Discussions

QA Instructions

  1. Generate or import an image into the canvas so that raster layers are present.

  2. Add an Inpaint Mask layer and mask the region you would like to extract.

  3. In the Layer Panel or on masked area, right-click the Inpaint Mask layer to open its context menu.

  4. Select Extract Region.

  5. Verify that:

  • The new layer contains only the composited pixel data within the painted mask region.
  • Colors and transparency match the masked area.
  • No existing layers are modified.
  • No console errors occur.
  1. Test with:
  • multiple raster layers,
  • small and large painted mask regions,
  • different zoom/crop states.

Merge Plan

This feature is self-contained and should not introduce merge conflicts.
It reuses existing Invoke canvas and image manipulation infrastructure.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added the frontend PRs that change frontend files label Nov 24, 2025
@DustyShoe DustyShoe changed the title Feature/add extract masked area feature v2 Feature(UI): add extract masked area from raster layers Nov 24, 2025
@DustyShoe DustyShoe force-pushed the Feature/add-extract-masked-area-feature-v2 branch from aa76538 to a9ab907 Compare November 29, 2025 10:17
Copy link
Collaborator

@lstein lstein left a comment

Choose a reason for hiding this comment

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

Works as advertised. I would like @blessedcoolant to give the code a quick lookover before merging.

@lstein lstein merged commit 259304b into invoke-ai:main Dec 22, 2025
13 checks passed
joshistoast pushed a commit to joshistoast/InvokeAI that referenced this pull request Dec 23, 2025
* chore: localize extraction errors

* chore: rename extract masked area menu item

* chore: rename inpaint mask extract component

* fix: use mask bounds for extraction region

* Prettier format applied to InpaintMaskMenuItemsExtractMaskedArea.tsx

* Fix base64 image import bug in extracted area in InpaintMaskMenuItemsExtractMaskedArea.tsx and removed unused locales entries in en.json

* Fix formatting issue in InpaintMaskMenuItemsExtractMaskedArea.tsx

* Minor comment fix

---------

Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend PRs that change frontend files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants