Skip to content

Conversation

@DustyShoe
Copy link
Contributor

@DustyShoe DustyShoe commented Nov 15, 2025

Summary

This PR introduces a new feature: Extract Inpaint Mask as a 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, masked, and added as a new raster layer.

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 paint on the mask.

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

  4. Select Extract Masked Area.

  5. Verify that:

  • A new raster layer is added at the top of the raster layer stack.
  • 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

  • Wait for CI checks (ESLint, Prettier, TypeScript) to pass.
  • Request maintainer review for compositing and extraction logic.
  • Optional: discuss potential improvements to the placement of the new raster layer.
  • After approval, squash-merge into the target branch.
  • No follow-up cleanup required.

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 15, 2025
@DustyShoe DustyShoe changed the title Feature mask extraction feat(ui): inpaint mask extraction to raster layer Nov 15, 2025

return (
<MenuItem onClick={onExtract} icon={<PiSelectionBackgroundBold />} isDisabled={isBusy}>
Extract masked area to new layer
Copy link
Contributor

Choose a reason for hiding this comment

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

Should use translation and get the title from en.json

Also, the current title looks a bit too long in the menu. Maybe something simpler like "Extract Region" or "Create Raster Layer".

Copy link
Contributor

Choose a reason for hiding this comment

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

From a user standpoint, it's not clear that the operation is restricted to the bounding box or why that would be the case. If I have a mask that exists exclusively outside of the bbox, then this operation returns an empty raster layer without any warnings. Perhaps we can piggyback off of the Merge Visible feature to create a new raster layer of the entire canvas, and then cut that down to match the inpaint mask dimensions and alpha.

@DustyShoe DustyShoe closed this Nov 17, 2025
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