Enlarge the Example 32 mask so the new shape can grow
The first version swapped a material onto the earcups without changing their outline, so nothing in the result showed that the alpha channel is being inpainted too - the silhouette moved by 47 pixels. The mask now covers both earcups plus a ring of the transparent background around them (25.1% of the frame, 70.9% of it on the headphones), and the instruction asks for the earcups to be rebuilt as oversized turbine cups that flare out past their old outline. The rebuilt region grows 11735 pixels of new silhouette over what used to be empty background, 100% of it inside the mask, while the headband, stitching, yokes and hinges stay pixel-identical (0.27/255 mean channel difference outside the mask). A 25% mask is still clean here; the earlier 16% guidance came from a picture whose mask had far less context left around it. Also verified that the alpha is a real channel rather than a trimmed-off fourth one: re-running with the identical RGB and a fully opaque alpha changes the masked region by 61.9/255 on average (max 254).
@@ -462,7 +462,7 @@ Check [Mased Qwen Edit Workflow](https://github.com/scraed/LanPaint/tree/master/
|
||||
|
||||
### Example Qwen Image 2.1 Image Edit: Masked InPaint(LanPaint K Sampler, 5 steps of thinking)
|
||||
|
||||
Qwen-Image 2.1's image edit model works under a mask. `Text Encode Qwen Image 2.1` takes your canvas as `<image1>` plus any extra references, and it is the only 2.1 text encoder that keeps the alpha channel of a reference (the older `Text Encode Qwen Image Edit Plus` drops it). Add `LanPaint_ImageEncode` with a mask and the instruction only lands inside that mask - here a second reference supplies the material, and the headband, stitching and hinges come back pixel-identical. Grab the workflow and images from `examples/Example_32` (or drag `InPainted_Drag_Me_to_ComfyUI.png` into ComfyUI); use your own pictures from the official [Qwen Image 2.1 Image Edit template](https://docs.comfy.org/tutorials/image/qwen/qwen-image-2-1).
|
||||
Qwen-Image 2.1's image edit model works under a mask. `Text Encode Qwen Image 2.1` takes your canvas as `<image1>` plus any extra references, and it is the only 2.1 text encoder that feeds the VAE all four channels (the older `Text Encode Qwen Image Edit Plus` trims a reference to RGB). Add `LanPaint_ImageEncode` with a mask and the instruction only lands inside that mask - here a second reference supplies the material, the earcups are rebuilt as oversized iridescent turbines that flare out over what used to be transparent background, and the headband, stitching and hinges come back pixel-identical. Grab the workflow and images from `examples/Example_32` (or drag `InPainted_Drag_Me_to_ComfyUI.png` into ComfyUI); use your own pictures from the official [Qwen Image 2.1 Image Edit template](https://docs.comfy.org/tutorials/image/qwen/qwen-image-2-1).
|
||||
|
||||

|
||||
[View Workflow & Masks](https://github.com/scraed/LanPaint/tree/master/examples/Example_32) · [Workflow JSON](https://github.com/scraed/LanPaint/blob/master/example_workflows/Qwen_Image_2.1_Edit_Masked_Inpaint.json)
|
||||
|
||||
|
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 199 KiB |
@@ -435,7 +435,7 @@
|
||||
"cnr_id": "comfy-core"
|
||||
},
|
||||
"widgets_values": [
|
||||
"The earcups of the headphones in <image1> are re-surfaced with the iridescent oil-slick titanium from <image2>: the exact same cup shapes, proportions and thickness as <image1>, now in mirror-polished rainbow metal with flowing cyan, magenta, violet and gold bands and a fine brushed grain. The headband, its stitching, the yokes and the hinges stay exactly as they are in <image1>. Studio product photography on a transparent background.",
|
||||
"The earcups of the headphones in <image1> are rebuilt as oversized iridescent turbine cups faced with the oil-slick titanium from <image2>: larger than the originals and flaring out past their old outline into the empty space around them, radiating machined blades, mirror-polished rainbow metal with flowing cyan, magenta, violet and gold bands and a fine brushed grain. The headband, its stitching, the yokes and the hinges stay exactly as they are in <image1>. Studio product photography on a transparent background.",
|
||||
"",
|
||||
1024
|
||||
],
|
||||
@@ -775,7 +775,7 @@
|
||||
"cnr_id": "comfy-core"
|
||||
},
|
||||
"widgets_values": [
|
||||
"## Qwen-Image 2.1 Image Edit + LanPaint, with a mask and with transparency\n\nThis is the official `Qwen Image 2.1 Image Edit` template with a mask bolted on. The edit\ninstruction names the references as `<image1>` / `<image2>`; `image_1` is the canvas,\n`image_2` is the material being borrowed.\n\nThe mask is what makes it inpainting rather than a re-render: LanPaint anchors everything\noutside it to the original on every step, so the headband, the stitching and the hinges come\nback untouched instead of merely similar. Keep the mask modest (about 15% of the frame here).\n\nTransparency survives because `Join Image With Alpha` puts the picture's alpha back on as a\n4th channel - `Load Image` hands alpha out on its `MASK` output, and that mask is `1 - alpha`,\nwhich is what this node wants, so there is no invert. `LanPaint_ImageDecode` then returns RGBA."
|
||||
"## Qwen-Image 2.1 Image Edit + LanPaint, with a mask and with transparency\n\nThis is the official `Qwen Image 2.1 Image Edit` template with a mask bolted on. The edit\ninstruction names the references as `<image1>` / `<image2>`; `image_1` is the canvas,\n`image_2` is the material being borrowed.\n\nAlpha is a real channel here, not a mask bolted on at the end. `Text Encode Qwen Image 2.1`\nfeeds the vision tower the alpha composited over white, but hands the VAE all four channels,\nand `LanPaint_ImageEncode` encodes the picture as it arrives - so the alpha is denoised\nalongside the pixels and the rebuilt region can grow a new silhouette. `Join Image With\nAlpha` is what puts the alpha back on the image: `Load Image` hands alpha out on its `MASK`\noutput, and that mask is `1 - alpha`, which is exactly what this node wants, so there is no\ninvert. `LanPaint_ImageDecode` then returns RGBA.\n\nThe mask is a separate greyscale file, white = edit here, and it is deliberately larger than\nthe earcups so the new shape has room to flare out over what used to be transparent\nbackground. Everything outside it is anchored to the original on every step, so the headband,\nthe stitching and the hinges come back untouched rather than merely similar."
|
||||
],
|
||||
"title": "How this works",
|
||||
"color": "#432",
|
||||
|
||||
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 938 KiB After Width: | Height: | Size: 1018 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 5.0 KiB |