Commit Graph
31 Commits
Author SHA1 Message Date
scraed 2d7912f9a5 Describe the Qwen 2.1 examples for readers, not for nodes
The two example sections were written from the inside of the graph: node class
names, the `<image1>` / `<image2>` notation, which loader to point where, and an
aside about which of the two 2.1 encoders keeps alpha. None of that helps
someone deciding whether to try the example.

Both sections now say what a user does and what comes back, in two sentences
each, and the news lines and the Updates entry follow. Example 31 also gains the
Workflow JSON link it was missing.

The MarkdownNote embedded in the Example 32 workflow gets the same treatment:
it keeps `<image1>` / `<image2>` (the instruction needs those) and drops the
`Join Image With Alpha` / `Load Image` MASK-output explanation.

The result image is byte-identical to the committed one; only the embedded
workflow metadata changed, which is why nothing was re-run.
2026-09-28 15:16:49 +08:00
scraed 93b90fad99 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).
2026-09-28 15:06:42 +08:00
scraed d82b218e1c Add a Qwen-Image 2.1 image edit example with a LanPaint mask
This is the official `Qwen Image 2.1 Image Edit` graph - a `TextEncodeQwenImage21`
fed through its autogrow `images` input, with the prompt naming the references as
`<image1>` / `<image2>` - carrying a LanPaint mask.

Three changes against the stock template: `LanPaint_ImageEncode` takes the mask,
`LanPaint_KSampler` does the sampling, and `LanPaint_ImageDecode` merges the result
back inside the mask and keeps RGBA. No new node inputs or outputs.

The demo re-surfaces a pair of headphones' earcups with the iridescent titanium of a
second reference image. The mask is 14.8% of the frame and 89% of it sits on the
headphones; outside the mask the output is pixel-identical to the source (mean
channel difference 0.098/255), so the headband, the stitching and the hinges are
untouched rather than merely similar. The source and the result are both RGBA.

`Text Encode Qwen Image 2.1` is the right reference encoder for transparent pictures:
it hands the vision tower the alpha composited over white and encodes all four
channels into the reference latent, where the older `Text Encode Qwen Image Edit Plus`
trims to RGB.

Verified by replaying the API prompt embedded in the packaged PNG against the shipped
input files: bit-identical output. The README gets the news block, a TOC entry, the
example section and an Updates line; the previous 2.1 heading now says "with
Transparency" so the two 2.1 examples are distinguishable.
2026-09-28 14:38:33 +08:00
scraed 391ca9625f Trim the Qwen 2.1 section to a paragraph
The section explained the VAE's channel count, the autogrow mismatch and the mask-size
measurements before saying where the example was. Keep what a reader needs: the model is
supported, transparency is inpainted too, and here is how to point it at your own picture.
The workflow's own note gets the same treatment.
2026-09-28 00:31:59 +08:00
scraed f564ee886b Add the Qwen-Image 2.1 example with transparent-background inpainting
LanPaint runs on Qwen-Image 2.1 unchanged: it is a rectified-flow model, so the
existing Flux/Qwen-Image conversions apply. Example_31 uses a text-to-image render
of its own model as the before/after, generated with a transparent background, and
keeps the inpainting mask in a separate greyscale file rather than in the picture's
alpha - 2.1's alpha channel means transparency, so overloading it would make the
two indistinguishable.

The transparency is carried into the latent and edited along with the pixels: the
2.1 VAE is 4-in/4-out (encoder.conv1 takes 4 channels, the decoder head emits 4),
and LoadImage's MASK output re-attaches through Join Image With Alpha, since that
mask is already 1 - alpha. The rebuilt sole grows past the old outline, so the
alpha in that region is generated rather than copied.

LanPaint_ImageDecode now matches the decoded channels to the source image: the 2.1
VAE always emits a 4th channel, which the merge could not broadcast. It keeps the
input's channel count, so an RGBA source comes back RGBA and an RGB source still
comes back RGB.
2026-09-28 00:25:23 +08:00
scraed 6948b2c766 Retire sampler hyperparameters, add MinStepFrac, and rework the video mask union
Retire Beta/Friction/EarlyStop/InnerThreshold/InnerPatience/MinStepFrac
from all sampler nodes: the widgets are gone, the values are fixed
constants, and old prompts still validate via hidden inputs. A value
sanitizer falls back to defaults on invalid widget values, and the
frontend migrates old workflows by key-based widgets_values mapping
(LAYOUTS table) instead of positional arrays, so kept parameters
(PromptMode, Inpainting_mode) survive on old workflows.

MinStepFrac defaults to 1.0: the inner step size is pinned and the
inner-step count ramps linearly with the remaining noise fraction.

Video mask union: resample nearest-exact first, then a slice-level
sliding max-pool (experimental order) so the mask follows the painted
region's motion through the video.

Update Example_29 with the new output and re-export the workflow JSON.
2026-08-12 17:24:03 +08:00
scraed f145728829 Fix MiniMax H3 on ComfyUI 0.31+ (FLOW_AV model type) and update Example_29
MiniMaxH3 became ModelType.FLOW_AV in ComfyUI 0.31 (bdcb886a: audio
carriage redesign); our IS_FLOW checks only matched ModelType.FLOW, so H3
silently fell into the VE schedule branch and sampled garbage (corrupted
video, clipped audio). Treat FLOW_AV as a flow type via a version-safe
getattr tuple.

Example_29: replace the output with the fixed run (InPainted mp4/gif +
combined showcase), and re-export example_workflows JSON from the new
output's embedded metadata. Bump version to 2.0.1.
2026-08-12 01:49:50 +08:00
scraed d1ee798b60 Convert the remaining examples to ImageEncode/ImageDecode and finish the example set
- Qwen Image Edit upgraded to the 2509 model (qwen_image_edit_2509_fp8_e4m3fn)
  with TextEncodeQwenImageEditPlus multi-image conditioning; old 2508/2509
  pairs removed.
- New Z-Image base example (z_image_bf16, Example_25 input) using default
  LanPaint parameters (NumSteps 5, Lambda 5.0, StepSize 0.2, Friction 15);
  old turbo/base pairs removed.
- Renamed the converted examples to the *_EncodeDecode_Inpaint convention
  (fresh names force the workflow gallery to reload them) and generated
  preview jpgs from the test run outputs; superseded old pairs removed,
  Qwen_Image_Outpaint and wan2_2_T2I_Partial kept as distinct use cases.
- Fixed the Qwen Image example mask reference: Example_12's file has no
  alpha channel (it is an output example), so it now points at Example_13's
  masked input (7).
- Repositioned the ImageEncode/ImageDecode nodes next to the sampler in all
  converted workflows (the conversion agents had placed them far off-canvas).
- SD3.5 and HiDream examples removed on request.
- Example_29 now ships the H3 masked input video and the inpainted output
  video (InPainted_Drag_Me_to_ComfyUI.mp4).
2026-08-09 22:46:51 +08:00
scraed 59aa08dff0 Store masks inside exported videos and convert the example set to ImageEncode/ImageDecode
Mask-in-video (the masks now travel with the video file):
- New videometa module: write/read a JSON payload under the lanpaint-mask
  mp4 metadata tag via PyAV (stream copy, movflags=use_metadata_tags), so
  exporting produces a NEW file and the source is never modified.
- Two server routes: GET /lanpaint/video_mask_meta (read the payload back)
  and POST /lanpaint/export_mask_video (remux into input/<base>_masked.mp4).
- The mask editor exports the painted keyframes (base64 PNGs) + audio
  intervals into the video; loading a video with the tag auto-restores the
  masks (editor and node preview). A video without the tag clears the
  workflow's masks - the video is the source of truth. The export also
  offers a native save dialog (showSaveFilePicker) when available.
- The video widget upload now uses video_upload so MP4s are selectable in
  the file chooser (was image_upload).
- LanPaint_ImageEncode accepts 5D latents from video VAEs encoding a single
  image (e.g. the Hunyuan video VAE) - fixes the Hunyuan example.

Example set conversion (one example per supported model, new files, old
pairs removed after being superseded):
- New *ImageEncode/*EncodeDecode example workflows for SDXL, Flux.1,
  Flux.2 Dev, Flux2 Klein, SD3.5, Hunyuan, Ideogram4, Krea2, Qwen Edit,
  Qwen Image, Z-Image, Wan 2.2 and MiniMax H3 (AV), all using
  LanPaint_ImageEncode/ImageDecode instead of VAEEncode +
  SetLatentNoiseMask + VAEDecode + MaskBlend; every example references its
  own example folder's masked input (hash-verified); preview jpgs generated
  from the test runs; the H3 example ships its output mp4 as a preview.
- HiDream example removed on request; Example_29 added with the H3 masked
  input video.

Fixes along the way: normalize node input.link/output.links fields against
the links arrays in all converted workflows (the frontend renders
null-link nodes as disconnected); stale Inpainting_mode widget removed from
the Flux.2 sampler; Lambda defaults 5.0 (first-order scheme); torchaudio
resample test assertion relaxed (edge ringing); the videometa tests updated
to the final export signature.
2026-08-09 20:41:45 +08:00
scraed c9c79988f1 Update Krea2 example with latest output and workflow 2026-06-28 10:48:50 +08:00
scraed 8b630eb6eb Update Flux2 Klein inpainting example with reference conditioning workflow 2026-06-27 23:42:01 +08:00
scraed 840c962fc9 Add Krea2 Turbo inpainting support with Example_28
- Add Krea2 banner, example section, and documentation to README
- Add new Example_28 with Krea2 LanPaint KSampler workflow
- Add workflow JSON and preview to example_workflows/
2026-06-27 17:45:09 +08:00
scraed b71f8e59b4 Add Ideogram4 inpainting support with Example_27
- Add Ideogram4 banner, example section, and documentation to README
- Add new Example_27 with Ideogram4 LanPaint Custom Sampler Advanced workflow
- Add workflow JSON to example_workflows/
- Fix widgets_values in Example_23 and Example_24 InPainted images
2026-06-27 11:21:11 +08:00
scraed 6a0f424f28 Add Anima inpainting example and workflow updates
Add Anima (Example_26) inpainting/outpainting support: update README with Anima example and changelog entry, add three example images (Original, Masked, Inpainted). Modify example_workflows/Qwen_Image_Inpaint.json to restructure and extend the node graph (add VAE/encode/decode, mask/image scaling/conversion, mask blending, updated links and node ids) and bump frontendVersion/node metadata for compatibility. Update .gitignore to ignore Claude-related files. Replace the Example_13 inpainted image binary with an updated version.
2026-05-21 11:26:35 +08:00
scraed 2522687dd5 Klein workflow update 2026-03-23 19:26:45 +08:00
scraed a984dcb118 Fix flux klein example workflow 2026-02-02 23:48:33 +08:00
scraed 8a72294f27 Z Image Base support 2026-01-30 00:45:20 +08:00
scraed 72cb484c40 Add Flux 2 Klein inpainting example and workflow
Added a new image inpainting example for Flux 2 Klein, including workflow JSON, sample images (original, masked, inpainted), and updated README with documentation and links. This provides users with a reference workflow and visual results for the Flux 2 Klein model.
2026-01-18 00:39:22 +08:00
charrywhite 9479106c1d Fix Flux2 Dev Inpaint workflow size bug 2026-01-10 12:43:40 +08:00
charrywhite db4bbbe9f2 Update Flux.2.Dev workflow Preview pic 2026-01-10 11:47:29 +08:00
charrywhite 4cc30f8a1d Fix Flux2.Dev Inpainting Workflow MaskBlend Bug 2026-01-10 11:41:53 +08:00
charrywhite 83f557ff4c Support Flux.2 Dev Inpainting 2026-01-06 22:42:07 +08:00
scraed 565087e8f8 fix z image resize error for inpaint 2025-12-15 18:15:15 +08:00
scraed 469012d183 Z image update 2025-12-04 14:17:29 +08:00
scraed 3d5aa3a3fa Add Hunyuan supports
Added new example workflows for Hunyuan, including images and JSON workflow files. Updated README with Hunyuan T2I inpainting instructions and links. Increased default LanPaint step size to 0.2 in nodes and advanced sampler, and refactored scale_latent_inpaint logic in lanpaint.py for improved compatibility.
2025-10-16 15:59:13 +08:00
scraed e653f45103 Support 2509 2025-09-24 18:27:11 +08:00
scraed c9c237c2de Add WAN 2.2 partial inpaint workflow template 2025-09-18 16:55:48 +08:00
scraed b8973c570b Support Wan 2.2 Txt 2 Img 2025-09-17 15:46:11 +08:00
scraed 1b50a90424 qwen edit resize fix 2025-09-07 13:07:17 +08:00
scraed e28e115297 add example workflow jsons 2025-08-25 11:37:31 +08:00
scraed eda0f19944 Generalize dimension handling in LanPaint and fix mask reshape
Refactored LanPaint to dynamically handle tensors with varying numbers of dimensions by introducing add_none_dims and remove_none_dims utility methods. Updated all relevant tensor broadcasting to use these methods, improving flexibility. Also fixed reshape_mask in nodes.py to use the last two dimensions for resizing, ensuring correct mask shape.
2025-08-08 13:42:24 +08:00