Add VTuber Live2D 11-part RGBA showcase video, layered PSD, PNG-to-PSD script, proof sheets, and stock ComfyUI workflow (int8_bf16mix)
Browse filesFiles changed (22)
- .gitattributes+17
- README.md+56-1
- scripts/layers_to_psd.pyAdded+610
- showcase/decomposition_report.jsonAdded+258
- showcase/input_vtuber.pngAdded
- showcase/layers/00_composite.pngAdded
- showcase/layers/01_front_hair.pngAdded
- showcase/layers/02_eyes.pngAdded
- showcase/layers/03_eyebrows.pngAdded
- showcase/layers/04_mouth.pngAdded
- showcase/layers/05_head_base.pngAdded
- showcase/layers/06_topwear.pngAdded
- showcase/layers/07_arms_hands.pngAdded
- showcase/layers/08_bottomwear.pngAdded
- showcase/layers/09_legs_footwear.pngAdded
- showcase/layers/10_back_hair.pngAdded
- showcase/layers/11_background.pngAdded
- showcase/vtuber_11layers_live2d.psdAdded
- showcase/vtuber_all_layers_showcase.pngAdded
- showcase/vtuber_layer_showcase.mp4Added+3
- showcase/vtuber_parts_closeup_sheet.pngAdded
- workflows/ming_image_0.2_design_layer_vtuber_rigging.jsonAdded+620
36 unmodified lines37383936 unmodified linesbenchmarks/comparison_christmas_poster.png filter=lfs diff=lfs merge=lfs -textbenchmarks/comparison_rigging.png filter=lfs diff=lfs merge=lfs -textbenchmarks/summary_grid.png filter=lfs diff=lfs merge=lfs -text36 unmodified lines373839404142434445464748495051525354555636 unmodified linesbenchmarks/comparison_christmas_poster.png filter=lfs diff=lfs merge=lfs -textbenchmarks/comparison_rigging.png filter=lfs diff=lfs merge=lfs -textbenchmarks/summary_grid.png filter=lfs diff=lfs merge=lfs -textshowcase/vtuber_layer_showcase.mp4 filter=lfs diff=lfs merge=lfs -textshowcase/vtuber_all_layers_showcase.png filter=lfs diff=lfs merge=lfs -textshowcase/vtuber_parts_closeup_sheet.png filter=lfs diff=lfs merge=lfs -textshowcase/input_vtuber.png filter=lfs diff=lfs merge=lfs -textshowcase/vtuber_11layers_live2d.psd filter=lfs diff=lfs merge=lfs -textshowcase/layers/00_composite.png filter=lfs diff=lfs merge=lfs -textshowcase/layers/01_front_hair.png filter=lfs diff=lfs merge=lfs -textshowcase/layers/02_eyes.png filter=lfs diff=lfs merge=lfs -textshowcase/layers/03_eyebrows.png filter=lfs diff=lfs merge=lfs -textshowcase/layers/04_mouth.png filter=lfs diff=lfs merge=lfs -textshowcase/layers/05_head_base.png filter=lfs diff=lfs merge=lfs -textshowcase/layers/06_topwear.png filter=lfs diff=lfs merge=lfs -textshowcase/layers/07_arms_hands.png filter=lfs diff=lfs merge=lfs -textshowcase/layers/08_bottomwear.png filter=lfs diff=lfs merge=lfs -textshowcase/layers/09_legs_footwear.png filter=lfs diff=lfs merge=lfs -textshowcase/layers/10_back_hair.png filter=lfs diff=lfs merge=lfs -textshowcase/layers/11_background.png filter=lfs diff=lfs merge=lfs -text
6 unmodified lines789101112131415161718197 unmodified lines2728293031326 unmodified lines- character-rigging- comfy_quant- quantizedbase_model:- inclusionAI/Ming-Image-0.2-Design-Layer---# Ming-Image-0.2-Design-Layer — Stock ComfyUI & FineQuant SuiteReady-to-use **stock ComfyUI** single-file packages (unmodified ComfyUI, zero custom nodes) for **[`inclusionAI/Ming-Image-0.2-Design-Layer`](https://huggingface.co/inclusionAI/Ming-Image-0.2-Design-Layer)**, covering **BF16 originals**, **4 sensitivity-guided FineQuant variants** (`int8_bf16mix`, `w4a8_mix`, `fp8_e4m3fn`, `nvfp4_fp8mix`), the shared **4-channel RGBA VAE**, and **3 ready-to-import ComfyUI workflows** (General Design, 2D Character Rigging, and Bounding-Box Decomposition).> **日本語概要 / Japanese Overview:**> `inclusionAI/Ming-Image-0.2-Design-Layer` の **Layer 専用 6B Next-DiT(`cap_pad_token` / `x_pad_token` 保持 + `image_model: ming_image` メタデータ埋め込み)** と、**0.2-Layer 向けに更新された専用 Text Encoder(MLLM + 更新版 Connector + MLP + Tokenizer 結合済み)** を、カスタムノード不要の **純正 ComfyUI 単一 `.safetensors` 形式(BF16 原版+厳選 FineQuant 4種)** としてそのまま使える形でまとめました。7 unmodified lines---## Visual RGBA Layer Decomposition Benchmarks (`CFG=2.0`, `12 steps`, `euler/simple`)Evaluated end-to-end in unmodified stock ComfyUI across all 3 official `inclusionAI/Ming-Image` Layer samples (`christmas_poster` 6 layers, `rigging` 11 layers, `bbox` 6 layers) at 512 aspect-preserving resolution buckets, decoded to `[N+1, H, W, 4]` RGBA via `LatentCutToBatch(dim="t", slice_size=1)` + `VAEDecode`.6 unmodified lines789101112131415161718192021227 unmodified lines303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586876 unmodified lines- character-rigging- comfy_quant- quantized- vtuber- live2d- psdbase_model:- inclusionAI/Ming-Image-0.2-Design-Layer---# Ming-Image-0.2-Design-Layer — Stock ComfyUI & FineQuant SuiteReady-to-use **stock ComfyUI** single-file packages (unmodified ComfyUI, zero custom nodes) for **[`inclusionAI/Ming-Image-0.2-Design-Layer`](https://huggingface.co/inclusionAI/Ming-Image-0.2-Design-Layer)**, covering **BF16 originals**, **4 sensitivity-guided FineQuant variants** (`int8_bf16mix`, `w4a8_mix`, `fp8_e4m3fn`, `nvfp4_fp8mix`), the shared **4-channel RGBA VAE**, and **4 ready-to-import ComfyUI workflows** (General Design, 2D Character Rigging, VTuber Live2D 11-Part Rigging, and Bounding-Box Decomposition), plus a Live2D/Photoshop/CLIP STUDIO PAINT-ready 11-layer RGBA `.psd` showcase and PNG-to-PSD converter script.> **日本語概要 / Japanese Overview:**> `inclusionAI/Ming-Image-0.2-Design-Layer` の **Layer 専用 6B Next-DiT(`cap_pad_token` / `x_pad_token` 保持 + `image_model: ming_image` メタデータ埋め込み)** と、**0.2-Layer 向けに更新された専用 Text Encoder(MLLM + 更新版 Connector + MLP + Tokenizer 結合済み)** を、カスタムノード不要の **純正 ComfyUI 単一 `.safetensors` 形式(BF16 原版+厳選 FineQuant 4種)** としてそのまま使える形でまとめました。7 unmodified lines---## VTuber Live2D 11-Part RGBA Showcase (`int8_bf16mix`, `672×896`)End-to-end 11-part Live2D-style character decomposition generated with our **`int8_bf16mix`** FineQuant package in unmodified stock ComfyUI semantics (`672×896`, `12 steps`, `CFG=2.0`, `euler/simple`, `seed=42`, NVIDIA L4 DiT Peak VRAM **9.97 GiB**): `Composite vs Input` achieves **PSNR 36.37 dB / SSIM 0.9877**, `Re-stacked (L11 → L1) vs Input` achieves **PSNR 29.82 dB / SSIM 0.9532**, and all **11/11** layers separate cleanly into independent RGBA parts. The packaged [`vtuber_11layers_live2d.psd`](./showcase/vtuber_11layers_live2d.psd) (`2.40 MiB`) crops each layer to tight per-part bounding boxes using `--alpha-threshold 4` (stripping the invisible `<=3/255` RGBA VAE background floor while preserving 100% of anti-aliasing `alpha >= 4`, verified lossless via `psd-tools`).> **日本語概要 / Japanese Overview:**> `int8_bf16mix`(DiT Peak VRAM `9.97 GiB`)を用い、`672×896`・`12 steps`・`CFG 2.0`・`euler/simple` で VTuber キャラクターを Live2D 向け 11 パーツ RGBA(前髪/目/眉/口/顔・首ベース/トップス/腕・手/スカート/脚・靴/後ろ髪/背景)へ一括分離した作例です。Photoshop / CLIP STUDIO PAINT / Live2D Cubism でそのまま開けるタイトバウンディングボックス版 11 レイヤー `.psd`、解説動画、個別 PNG、純正 ComfyUI ワークフロー、PNG→PSD 変換スクリプトを同梱しています。<video controls autoplay loop muted playsinline width="100%" src="https://huggingface.co/StudioYebisu-ship-it/Ming-Image-0.2-Design-Layer-FineQuant-ComfyUI/resolve/main/showcase/vtuber_layer_showcase.mp4"></video>- **Layered `.psd` (Photoshop / CLIP STUDIO PAINT / Live2D Cubism, 2.40 MiB):** [`showcase/vtuber_11layers_live2d.psd`](./showcase/vtuber_11layers_live2d.psd)- **Stock ComfyUI Workflow (11-Part VTuber Rigging):** [`workflows/ming_image_0.2_design_layer_vtuber_rigging.json`](./workflows/ming_image_0.2_design_layer_vtuber_rigging.json)- **PNG → Layered PSD Converter Script (`Pillow` + `NumPy`):** [`scripts/layers_to_psd.py`](./scripts/layers_to_psd.py)- **Showcase Video (1080p 30fps MP4, 3.04 MiB):** [`showcase/vtuber_layer_showcase.mp4`](./showcase/vtuber_layer_showcase.mp4)- **Input Illustration:** [`showcase/input_vtuber.png`](./showcase/input_vtuber.png)- **Individual RGBA PNG Layers (`00_composite` + `L01`–`L11`):** [`showcase/layers/`](./showcase/layers/)<details><summary>Click to expand Live2D parts close-ups, input illustration, and 11-layer measurements</summary>- - | Layer (PSD Order Top → Bottom) | Tight BBox (`W×H`, PSD `α≥4`) | Core BBox (`α≥20`) | Alpha Coverage (`α≥20`) | PNG File || :--- | :---: | :---: | :---: | :--- || `L01_Front_Hair` | `105×135` | `105×134` | `1.024%` | [`01_front_hair.png`](./showcase/layers/01_front_hair.png) || `L02_Eyes` | `73×19` | `71×19` | `0.117%` | [`02_eyes.png`](./showcase/layers/02_eyes.png) || `L03_Eyebrows` | `63×6` | `62×5` | `0.023%` | [`03_eyebrows.png`](./showcase/layers/03_eyebrows.png) || `L04_Mouth` | `23×25` | `23×23` | `0.042%` | [`04_mouth.png`](./showcase/layers/04_mouth.png) || `L05_Head_Base` | `94×117` | `94×114` | `1.177%` | [`05_head_base.png`](./showcase/layers/05_head_base.png) || `L06_Topwear` | `138×140` | `137×139` | `2.511%` | [`06_topwear.png`](./showcase/layers/06_topwear.png) || `L07_Arms_and_Hands` | `492×233` | `491×232` | `4.388%` | [`07_arms_hands.png`](./showcase/layers/07_arms_hands.png) || `L08_Bottomwear` | `212×173` | `211×172` | `4.069%` | [`08_bottomwear.png`](./showcase/layers/08_bottomwear.png) || `L09_Legs_and_Footwear` | `175×443` | `175×443` | `7.239%` | [`09_legs_footwear.png`](./showcase/layers/09_legs_footwear.png) || `L10_Back_Hair` | `262×301` | `262×301` | `4.470%` | [`10_back_hair.png`](./showcase/layers/10_back_hair.png) || `L11_Background` | `672×896` | `672×896` | `100.000%` | [`11_background.png`](./showcase/layers/11_background.png) |</details>### Converting ComfyUI RGBA Outputs to Layered `.psd`Requires only `Pillow` and `NumPy` (no custom nodes needed in ComfyUI):```bashpython scripts/layers_to_psd.py ComfyUI/output/ming_layer_output_*.png --skip-composite -o character_layers.psd --verify```*(Uses `--alpha-threshold 4` by default to trim invisible VAE background haze while preserving anti-aliasing; pass `--alpha-threshold 0` for uncropped raw pixels.)*---## Visual RGBA Layer Decomposition Benchmarks (`CFG=2.0`, `12 steps`, `euler/simple`)Evaluated end-to-end in unmodified stock ComfyUI across all 3 official `inclusionAI/Ming-Image` Layer samples (`christmas_poster` 6 layers, `rigging` 11 layers, `bbox` 6 layers) at 512 aspect-preserving resolution buckets, decoded to `[N+1, H, W, 4]` RGBA via `LatentCutToBatch(dim="t", slice_size=1)` + `VAEDecode`.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610#!/usr/bin/env python3"""Convert aligned RGBA layer PNGs into an Adobe Photoshop PSD v1 file.
Designed for Ming-Image-0.2-Design-Layer ComfyUI outputs so Photoshop,CLIP STUDIO PAINT, and Live2D Cubism Editor open every part as analigned, named, visible RGBA layer. Requires only Pillow and NumPy."""
from __future__ import annotations
import argparsefrom dataclasses import dataclassimport globimport jsonfrom pathlib import Pathimport reimport structimport sys
import numpy as npfrom PIL import Image
@dataclass(frozen=True)class LayerSpec: """Single RGBA layer ready for PSD serialization."""
name: str image: np.ndarray # uint8 array of shape (H, W, 4) visible: bool = True opacity: int = 255
def _natural_key(path: Path) -> list[int | str]: parts = re.split(r"(\d+)", path.name) return [int(p) if p.isdigit() else p.lower() for p in parts]
def _packbits_encode_row(row: bytes) -> bytes: """Encode one scanline with standard PackBits RLE (no 0x80 no-op byte).""" n = len(row) if n == 0: return b"" out = bytearray() literals = bytearray() i = 0
def flush_literals() -> None: while literals: chunk = literals[:128] del literals[:128] out.append(len(chunk) - 1) out.extend(chunk)
while i < n: run_val = row[i] run_len = 1 while i + run_len < n and run_len < 128 and row[i + run_len] == run_val: run_len += 1
# Emit an RLE packet when >=3 repeats or when 2 repeats aren't mid-literal. if run_len >= 3 or (run_len == 2 and not literals): flush_literals() out.append((257 - run_len) & 0xFF) out.append(run_val) i += run_len else: literals.append(run_val) i += 1
flush_literals() return bytes(out)
def _flip_last_row_parity(row: bytes, encoded: bytes) -> bytes: """Return a valid PackBits encoding of row with opposite length parity.
Only called when width >= 2 because single-byte rows always encode to 2 bytes. """ target_parity = (len(encoded) & 1) ^ 1 candidates = [ _packbits_encode_row(row[:-1]) + bytes([0, row[-1]]), bytes([0, row[0]]) + _packbits_encode_row(row[1:]), ] for cand in candidates: if (len(cand) & 1) == target_parity and len(cand) <= 32767: return cand
# Build literal 128-byte chunks; splitting any chunk of size >=2 flips parity. chunks = [row[i : min(i + 128, len(row))] for i in range(0, len(row), 128)] lit = b"".join(bytes([len(c) - 1]) + c for c in chunks) if (len(lit) & 1) == target_parity: return lit
split_idx = next(idx for idx, c in enumerate(chunks) if len(c) >= 2) c = chunks[split_idx] replacement = [c[:1], c[1:]] chunks = chunks[:split_idx] + replacement + chunks[split_idx + 1 :] return b"".join(bytes([len(ch) - 1]) + ch for ch in chunks)
def _encode_channel_rle(channel_2d: np.ndarray) -> bytes: """Encode a (H, W) uint8 plane into an even-length PSD PackBits channel block.""" h, w = channel_2d.shape if h == 0 or w == 0: return struct.pack(">H", 0)
raw_bytes = np.ascontiguousarray(channel_2d, dtype=np.uint8).tobytes() rows = [_packbits_encode_row(raw_bytes[y * w : (y + 1) * w]) for y in range(h)] total_payload = sum(len(r) for r in rows) if (total_payload & 1) != 0 and w >= 2: last_raw = raw_bytes[(h - 1) * w : h * w] rows[-1] = _flip_last_row_parity(last_raw, rows[-1])
counts = b"".join(struct.pack(">H", len(r)) for r in rows) return struct.pack(">H", 1) + counts + b"".join(rows)
def _tight_bbox(alpha: np.ndarray, crop: bool) -> tuple[int, int, int, int]: h, w = alpha.shape if not crop: return (0, 0, h, w) ys, xs = np.nonzero(alpha > 0) if ys.size == 0: return (0, 0, 0, 0) return (int(ys.min()), int(xs.min()), int(ys.max()) + 1, int(xs.max()) + 1)
def _encode_pascal_name(name: str) -> bytes: # PSD legacy layer name is Latin-1 Pascal string (<=255 bytes), padded to 4B. ascii_bytes = name.encode("latin-1", "replace")[:255] raw = bytes([len(ascii_bytes)]) + ascii_bytes pad = (-len(raw)) & 3 return raw + (b"\x00" * pad)
def _encode_additional_layer_info(name: str, layer_id: int) -> bytes: utf16 = name.encode("utf-16-be") luni_body = struct.pack(">I", len(name)) + utf16 if len(luni_body) & 3: luni_body += b"\x00" * (4 - (len(luni_body) & 3)) luni_block = b"8BIM" + b"luni" + struct.pack(">I", len(luni_body)) + luni_body lyid_block = b"8BIM" + b"lyid" + struct.pack(">II", 4, layer_id) return luni_block + lyid_block
def _composite_rgb_preview(layers_bottom_to_top: list[LayerSpec], width: int, height: int) -> np.ndarray: """Alpha-composite layers bottom-to-top onto opaque white RGB canvas.""" canvas = np.full((height, width, 3), 255.0, dtype=np.float32) for layer in layers_bottom_to_top: if not layer.visible or layer.opacity == 0: continue rgba = layer.image.astype(np.float32) src_rgb = rgba[:, :, :3] src_a = (rgba[:, :, 3:4] / 255.0) * (layer.opacity / 255.0) canvas = src_rgb * src_a + canvas * (1.0 - src_a) return np.clip(np.rint(canvas), 0, 255).astype(np.uint8)
def _encode_merged_image_data(rgb: np.ndarray) -> bytes: """Encode merged opaque RGB preview as PackBits RLE Image Data section.""" h, w, _ = rgb.shape counts: list[bytes] = [] payload: list[bytes] = [] for c in range(3): plane = np.ascontiguousarray(rgb[:, :, c], dtype=np.uint8).tobytes() for y in range(h): encoded = _packbits_encode_row(plane[y * w : (y + 1) * w]) counts.append(struct.pack(">H", len(encoded))) payload.append(encoded) return struct.pack(">H", 1) + b"".join(counts) + b"".join(payload)
def write_psd( layers_bottom_to_top: list[LayerSpec], output_path: Path, dpi: int = 72, crop: bool = True,) -> dict[str, object]: """Serialize aligned RGBA layers into an Adobe Photoshop PSD v1 file.""" if not layers_bottom_to_top: raise ValueError("At least one layer is required to write a PSD.")
height, width, channels = layers_bottom_to_top[0].image.shape if channels != 4: raise ValueError(f"Expected 4-channel RGBA array, got shape {layers_bottom_to_top[0].image.shape}") for layer in layers_bottom_to_top: if layer.image.shape != (height, width, 4): raise ValueError( f"Layer {layer.name!r} has shape {layer.image.shape}, expected {(height, width, 4)}" )
header = ( b"8BPS" + struct.pack(">H", 1) + (b"\x00" * 6) + struct.pack(">HIIHH", 3, height, width, 8, 3) ) color_mode_data = struct.pack(">I", 0)
dpi_fixed = int(round(dpi * 65536)) res_block = ( b"8BIM" + struct.pack(">H", 1005) + b"\x00\x00" + struct.pack(">I", 16) + struct.pack(">iHHiHH", dpi_fixed, 1, 1, dpi_fixed, 1, 1) ) image_resources = struct.pack(">I", len(res_block)) + res_block
records_buf = bytearray() channel_data_buf = bytearray() bboxes: dict[str, tuple[int, int, int, int]] = {} channel_ids = (0, 1, 2, -1)
for idx, layer in enumerate(layers_bottom_to_top, start=1): top, left, bottom, right = _tight_bbox(layer.image[:, :, 3], crop=crop) bboxes[layer.name] = (left, top, right, bottom) is_empty = top >= bottom or left >= right
records_buf.extend(struct.pack(">iiiiH", top, left, bottom, right, len(channel_ids))) for ch_id in channel_ids: if is_empty: ch_bytes = struct.pack(">H", 0) else: src_idx = 3 if ch_id == -1 else ch_id plane = layer.image[top:bottom, left:right, src_idx] ch_bytes = _encode_channel_rle(plane) records_buf.extend(struct.pack(">hI", ch_id, len(ch_bytes))) channel_data_buf.extend(ch_bytes)
# Blend flags bit 1 (0x02) means hidden in Adobe PSD specification. flags = 0x00 if layer.visible else 0x02 records_buf.extend( b"8BIM" + b"norm" + struct.pack(">BBBB", layer.opacity, 0, flags, 0) )
extra = bytearray() extra.extend(struct.pack(">I", 0)) # Layer mask data length extra.extend(struct.pack(">I", 0)) # Layer blending ranges length extra.extend(_encode_pascal_name(layer.name)) extra.extend(_encode_additional_layer_info(layer.name, idx)) records_buf.extend(struct.pack(">I", len(extra))) records_buf.extend(extra)
layer_info = bytearray() layer_info.extend(struct.pack(">h", len(layers_bottom_to_top))) layer_info.extend(records_buf) layer_info.extend(channel_data_buf) if len(layer_info) & 1: layer_info.append(0)
layer_and_mask_body = ( struct.pack(">I", len(layer_info)) + bytes(layer_info) + struct.pack(">I", 0) # Global layer mask info ) layer_and_mask_section = struct.pack(">I", len(layer_and_mask_body)) + layer_and_mask_body
merged_rgb = _composite_rgb_preview(layers_bottom_to_top, width, height) image_data_section = _encode_merged_image_data(merged_rgb)
output_path.parent.mkdir(parents=True, exist_ok=True) with open(output_path, "wb") as fh: fh.write(header) fh.write(color_mode_data) fh.write(image_resources) fh.write(layer_and_mask_section) fh.write(image_data_section)
return { "width": width, "height": height, "layer_count": len(layers_bottom_to_top), "bytes": output_path.stat().st_size, "bboxes": bboxes, }
def _resolve_inputs(raw_inputs: list[str]) -> list[Path]: resolved: list[Path] = [] for item in raw_inputs: p = Path(item) if p.is_dir(): files = sorted((f for f in p.iterdir() if f.suffix.lower() == ".png"), key=_natural_key) resolved.extend(files) elif p.exists(): resolved.append(p) else: matches = sorted((Path(m) for m in glob.glob(item)), key=_natural_key) resolved.extend(matches)
seen: set[Path] = set() unique: list[Path] = [] for p in resolved: rp = p.resolve() if rp not in seen: seen.add(rp) unique.append(p) return unique
def _default_layer_name(path: Path, index: int) -> str: stem = path.stem m = re.match(r"^(\d+)[_-](.+)$", stem) if m: num = int(m.group(1)) words = [w.capitalize() for w in re.split(r"[_-]+", m.group(2)) if w] return f"L{num:02d}_{'_'.join(words)}" if words else f"L{num:02d}" clean = re.sub(r"[^A-Za-z0-9_-]+", "_", stem).strip("_") return clean or f"L{index:02d}"
def _names_from_report(report_path: Path) -> list[str]: data = json.loads(report_path.read_text(encoding="utf-8")) names: list[str] = [] for entry in data.get("layers", []): if int(entry.get("frame_idx", -1)) == 0: continue label = str(entry.get("label", "")) prompt_head = str(entry.get("prompt_head", "")) prefix = f"L{int(entry['frame_idx']):02d}_" english = label.split("/")[-1].strip() if "/" in label else prompt_head.strip() slug = re.sub(r"[^A-Za-z0-9]+", "_", english).strip("_") names.append(f"{prefix}{slug}" if slug else f"L{int(entry['frame_idx']):02d}") return names
def _packbits_decode_row(data: bytes, expected_len: int) -> bytes: out = bytearray() i = 0 n = len(data) while i < n and len(out) < expected_len: hdr = data[i] i += 1 if hdr < 128: count = hdr + 1 out.extend(data[i : i + count]) i += count elif hdr > 128: count = 257 - hdr out.extend([data[i]] * count) i += 1 if len(out) != expected_len: raise AssertionError(f"Decoded PackBits scanline length {len(out)} != {expected_len}") return bytes(out)
def _read_luni_and_lyid(extra: bytes) -> tuple[str | None, int | None]: pos = 0 mask_len = struct.unpack_from(">I", extra, pos)[0] pos += 4 + mask_len blend_len = struct.unpack_from(">I", extra, pos)[0] pos += 4 + blend_len pascal_len = extra[pos] pos += ((1 + pascal_len) + 3) & ~3 luni_name: str | None = None lyid_val: int | None = None while pos + 12 <= len(extra): sig, key, size = struct.unpack_from(">4s4sI", extra, pos) pos += 12 if sig not in (b"8BIM", b"8B64"): break block = extra[pos : pos + size] if key == b"luni" and len(block) >= 4: char_count = struct.unpack_from(">I", block, 0)[0] luni_name = block[4 : 4 + char_count * 2].decode("utf-16-be") elif key == b"lyid" and len(block) >= 4: lyid_val = struct.unpack_from(">I", block, 0)[0] pos += (size + 3) & ~3 return luni_name, lyid_val
def _verify_psd( psd_path: Path, expected_bottom_to_top: list[LayerSpec], expected_bboxes: dict[str, tuple[int, int, int, int]],) -> None: height, width, _ = expected_bottom_to_top[0].image.shape expected_preview = _composite_rgb_preview(expected_bottom_to_top, width, height)
# 1. Verify merged preview and layer directory via Pillow. with Image.open(psd_path) as im: if im.size != (width, height): raise AssertionError(f"Merged canvas mismatch: got {im.size}, expected {(width, height)}") if im.mode != "RGB": raise AssertionError(f"Merged mode mismatch: got {im.mode!r}, expected 'RGB'") preview_arr = np.asarray(im, dtype=np.int16) preview_diff = int(np.max(np.abs(preview_arr - expected_preview.astype(np.int16)))) if preview_diff != 0: raise AssertionError(f"Merged RGB preview diff={preview_diff}") if im.n_frames != len(expected_bottom_to_top): raise AssertionError( f"Layer count mismatch: got {im.n_frames}, expected {len(expected_bottom_to_top)}" ) for idx, spec in enumerate(expected_bottom_to_top): layer_name, layer_mode, layer_bbox, _ = im.layers[idx] if layer_mode != "RGBA": raise AssertionError(f"Layer {idx} mode mismatch: {layer_mode!r}") exp_bbox = expected_bboxes[spec.name] if layer_bbox != exp_bbox: raise AssertionError( f"Layer {spec.name!r} bbox mismatch: got {layer_bbox}, expected {exp_bbox}" ) if layer_name != spec.name[:255]: raise AssertionError( f"Layer {idx} PIL name mismatch: got {layer_name!r}, expected {spec.name[:255]!r}" )
# 2. Verify raw binary structure, Unicode names, and PackBits pixel parity. data = psd_path.read_bytes() if data[:4] != b"8BPS": raise AssertionError("Missing 8BPS signature") pos = 26 pos += 4 + struct.unpack_from(">I", data, pos)[0] # Color mode data pos += 4 + struct.unpack_from(">I", data, pos)[0] # Image resources pos += 4 # Layer & mask section length pos += 4 # Layer info length layer_count = struct.unpack_from(">h", data, pos)[0] pos += 2 if layer_count != len(expected_bottom_to_top): raise AssertionError(f"Binary layer_count={layer_count}, expected {len(expected_bottom_to_top)}")
parsed_records: list[tuple[tuple[int, int, int, int], list[tuple[int, int]]]] = [] for idx, spec in enumerate(expected_bottom_to_top, start=1): top, left, bottom, right, nc = struct.unpack_from(">iiiiH", data, pos) pos += 18 if (left, top, right, bottom) != expected_bboxes[spec.name]: raise AssertionError(f"Binary bbox mismatch on {spec.name}") ch_meta: list[tuple[int, int]] = [] for _ in range(nc): cid, clen = struct.unpack_from(">hI", data, pos) pos += 6 ch_meta.append((cid, clen)) sig, blend_key, opacity, clipping, flags, _ = struct.unpack_from(">4s4sBBBB", data, pos) pos += 12 if sig != b"8BIM" or blend_key != b"norm" or clipping != 0: raise AssertionError(f"Invalid blend record on {spec.name}") expected_flag = 0x00 if spec.visible else 0x02 if opacity != spec.opacity or flags != expected_flag: raise AssertionError(f"Opacity/flags mismatch on {spec.name}") extra_len = struct.unpack_from(">I", data, pos)[0] pos += 4 luni_name, lyid_val = _read_luni_and_lyid(data[pos : pos + extra_len]) if luni_name != spec.name or lyid_val != idx: raise AssertionError( f"luni/lyid mismatch on {spec.name}: luni={luni_name!r}, lyid={lyid_val}" ) pos += extra_len parsed_records.append(((left, top, right, bottom), ch_meta))
for spec, ((left, top, right, bottom), ch_meta) in zip(expected_bottom_to_top, parsed_records): bw, bh = right - left, bottom - top decoded_planes: dict[int, np.ndarray] = {} for cid, clen in ch_meta: ch_end = pos + clen comp = struct.unpack_from(">H", data, pos)[0] p = pos + 2 if bw > 0 and bh > 0: if comp != 1: raise AssertionError(f"Expected PackBits compression=1 on {spec.name}, got {comp}") row_lens = struct.unpack_from(f">{bh}H", data, p) p += bh * 2 rows = bytearray() for rlen in row_lens: rows.extend(_packbits_decode_row(data[p : p + rlen], bw)) p += rlen decoded_planes[cid] = np.frombuffer(rows, dtype=np.uint8).reshape((bh, bw)) pos = ch_end if bw > 0 and bh > 0: rebuilt = np.stack( [decoded_planes[0], decoded_planes[1], decoded_planes[2], decoded_planes[-1]], axis=-1, ) src_crop = spec.image[top:bottom, left:right] max_diff = int(np.max(np.abs(rebuilt.astype(np.int16) - src_crop.astype(np.int16)))) if max_diff != 0: raise AssertionError(f"Layer {spec.name!r} binary PackBits pixel diff={max_diff}")
# 3. Optional cross-check via psd-tools if installed in current Python. try: from psd_tools import PSDImage # type: ignore[import-not-found] except ImportError: return psd = PSDImage.open(psd_path) if len(psd) != len(expected_bottom_to_top): raise AssertionError(f"psd-tools layer count {len(psd)} != {len(expected_bottom_to_top)}") for spec, layer in zip(expected_bottom_to_top, psd): got = np.asarray(layer.topil(), dtype=np.int16) left, top, right, bottom = expected_bboxes[spec.name] if left < right and top < bottom: src_crop = spec.image[top:bottom, left:right].astype(np.int16) if int(np.max(np.abs(got - src_crop))) != 0: raise AssertionError(f"psd-tools pixel mismatch on {spec.name}")
def main(argv: list[str] | None = None) -> int: parser = argparse.ArgumentParser( description="Pack aligned Ming-Image RGBA PNG layers into a Photoshop/CLIP STUDIO/Live2D PSD." ) parser.add_argument( "inputs", nargs="+", help="Input PNG files, directory, or glob patterns in layer order.", ) parser.add_argument("-o", "--output", required=True, type=Path, help="Output .psd path.") parser.add_argument( "--skip-composite", action="store_true", help="Skip the first input image (Ming-Image frame 00 composite).", ) parser.add_argument( "--order", choices=("top-to-bottom", "bottom-to-top"), default="top-to-bottom", help="Order of input PNGs. Ming-Image outputs Layer 1..N top-to-bottom (default).", ) parser.add_argument( "--names", type=str, default=None, help="Comma-separated layer names matching the input order.", ) parser.add_argument( "--report", type=Path, default=None, help="Optional decomposition_report.json to derive layer names.", ) parser.add_argument( "--alpha-threshold", type=int, default=4, help=( "Zero out pixels with alpha below this 0-255 threshold before tight cropping " "(default: 4, removes invisible VAE floor while keeping anti-aliasing; 0 keeps raw pixels)." ), ) parser.add_argument( "--no-crop", action="store_true", help="Keep full canvas bounds instead of tight non-transparent bounding boxes.", ) parser.add_argument("--dpi", type=int, default=72, help="Document DPI metadata (default: 72).") parser.add_argument( "--verify", action="store_true", help="Re-open output PSD with Pillow + strict binary decoder (and psd-tools if installed) to assert lossless parity.", )
args = parser.parse_args(argv) if not 0 <= args.alpha_threshold <= 255: parser.error("--alpha-threshold must be between 0 and 255.") paths = _resolve_inputs(args.inputs) if args.skip_composite: if len(paths) < 2: parser.error("--skip-composite requires at least 2 input images.") paths = paths[1:]
if not paths: parser.error("No PNG files resolved from inputs.")
if args.names: layer_names = [n.strip() for n in args.names.split(",") if n.strip()] if len(layer_names) != len(paths): parser.error(f"--names count ({len(layer_names)}) does not match input files ({len(paths)}).") elif args.report: layer_names = _names_from_report(args.report) if len(layer_names) != len(paths): parser.error(f"--report layer count ({len(layer_names)}) does not match inputs ({len(paths)}).") else: layer_names = [_default_layer_name(p, i + 1) for i, p in enumerate(paths)]
specs: list[LayerSpec] = [] for name, path in zip(layer_names, paths): with Image.open(path) as im: rgba = np.asarray(im.convert("RGBA"), dtype=np.uint8) if args.alpha_threshold > 0: rgba = rgba.copy() rgba[rgba[:, :, 3] < args.alpha_threshold] = 0 specs.append(LayerSpec(name=name, image=rgba))
layers_bottom_to_top = list(reversed(specs)) if args.order == "top-to-bottom" else specs info = write_psd( layers_bottom_to_top=layers_bottom_to_top, output_path=args.output, dpi=args.dpi, crop=not args.no_crop, )
if args.verify: _verify_psd( args.output, layers_bottom_to_top, info["bboxes"], # type: ignore[arg-type] )
print( f"[layers_to_psd] Wrote {args.output} ({info['bytes']:,} bytes, " f"{info['width']}x{info['height']}, {info['layer_count']} RGBA layers" + (", verified OK" if args.verify else "") + ")" ) return 0
if __name__ == "__main__": sys.exit(main())123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258{ "device_name": "NVIDIA L4", "input_original_path": "showcase/input_vtuber.png", "input_scaled_path": "672x896 lanczos resize of showcase/input_vtuber.png", "restacked_path": "showcase/vtuber_11layers_live2d.psd", "prompt_file": "workflows/ming_image_0.2_design_layer_vtuber_rigging.json", "prompt_text": "Decompose this image into 11 layers with the following specifications:\n\nNumber of layers: 11\nLayer 1: Front Hair. Silver-white center-parted front hair and cheek-framing side locks bordering the forehead and temples without covering the eyebrows.\nLayer 2: Eyes. Large vivid sapphire-blue anime eyes with crisp black upper eyelashes, dark pupils, glowing white specular highlights, sclera, and subtle lower lid shading.\nLayer 3: Eyebrows. Two thin, clean, gently arched silver-gray eyebrows positioned clearly above each eye.\nLayer 4: Mouth. A small, clean curved closed-mouth smile centered on the lower face.\nLayer 5: Head (Source Base). Fair peach skin base forming the face, chin, ears, and neck with crisp dark outline, excluding eyes, eyebrows, mouth, and hair.\nLayer 6: Topwear. Cropped dark navy idol jacket with crimson lapels, gold piping, shoulder epaulettes, small chest crest badge, white collared buttoned blouse, and crimson neck bow tie with a gold center clasp.\nLayer 7: Arms, Sleeves and Hands. Both outstretched 45-degree dark navy sleeves ending in red-and-white bands, detached navy wrist cuffs with gold buttons, bare forearms, and open five-finger hands.\nLayer 8: Bottomwear. High-waisted dark navy pleated mini skirt featuring a gold-buttoned waist band, double gold horizontal stripes along the skirt hem, and crimson under-pleats.\nLayer 9: Legs and Footwear (Both). Both unoccluded legs showing upper thighs, sheer dark charcoal thigh-high stockings with lace tops, and glossy black Mary Jane platform shoes.\nLayer 10: Back Hair. Long voluminous silver-white twin-tails fading into pastel lavender curled tips, secured by red ribbon hair ties and flowing behind the shoulders and upper arms.\nLayer 11: Background. Plain, solid pure white backdrop with no gradients, cast shadows, or markings.", "dit_path": "diffusion_models/ming_image_0.2_design_layer_yebisu_int8_bf16mix.safetensors", "te_path": "text_encoders/ming_image_0.2_ling_mini_2.0_layer_yebisu_int8_bf16mix.safetensors", "vae_path": "vae/ming_image_vae_bf16.safetensors", "width": 672, "height": 896, "num_layers": 11, "steps": 12, "cfg": 2.0, "seed": 42, "te_offloaded": false, "te_seconds": 10.53, "te_peak_vram_gib": 18.807, "dit_sample_seconds": 316.85, "dit_peak_vram_gib": 9.966, "vae_decode_seconds": 2.75, "composite_vs_input_psnr": 36.372, "composite_vs_input_ssim": 0.9877, "restacked_vs_input_psnr": 29.817, "restacked_vs_input_ssim": 0.9532, "non_empty_layers": 11, "layers": [ { "frame_idx": 0, "slug": "composite", "label": "Frame 00 / Composite", "prompt_head": "Full Composite", "path": "showcase/layers/00_composite.png", "alpha_coverage_pct": 100.0, "alpha_min": 191, "alpha_max": 255, "tight_bbox": [ 0, 0, 671, 895 ], "bbox_w": 672, "bbox_h": 896, "non_empty": true }, { "frame_idx": 1, "slug": "front_hair", "label": "L01 前髪 / Front Hair", "prompt_head": "Front Hair", "path": "showcase/layers/01_front_hair.png", "alpha_coverage_pct": 1.024, "alpha_min": 0, "alpha_max": 255, "tight_bbox": [ 281, 65, 385, 198 ], "bbox_w": 105, "bbox_h": 134, "non_empty": true }, { "frame_idx": 2, "slug": "eyes", "label": "L02 目 / Eyes", "prompt_head": "Eyes", "path": "showcase/layers/02_eyes.png", "alpha_coverage_pct": 0.117, "alpha_min": 0, "alpha_max": 255, "tight_bbox": [ 298, 127, 368, 145 ], "bbox_w": 71, "bbox_h": 19, "non_empty": true }, { "frame_idx": 3, "slug": "eyebrows", "label": "L03 眉 / Eyebrows", "prompt_head": "Eyebrows", "path": "showcase/layers/03_eyebrows.png", "alpha_coverage_pct": 0.023, "alpha_min": 0, "alpha_max": 255, "tight_bbox": [ 302, 117, 363, 121 ], "bbox_w": 62, "bbox_h": 5, "non_empty": true }, { "frame_idx": 4, "slug": "mouth", "label": "L04 口 / Mouth", "prompt_head": "Mouth", "path": "showcase/layers/04_mouth.png", "alpha_coverage_pct": 0.042, "alpha_min": 0, "alpha_max": 255, "tight_bbox": [ 322, 149, 344, 171 ], "bbox_w": 23, "bbox_h": 23, "non_empty": true }, { "frame_idx": 5, "slug": "head_base", "label": "L05 顔・首ベース / Head Base", "prompt_head": "Head (Source Base)", "path": "showcase/layers/05_head_base.png", "alpha_coverage_pct": 1.177, "alpha_min": 0, "alpha_max": 255, "tight_bbox": [ 287, 86, 380, 199 ], "bbox_w": 94, "bbox_h": 114, "non_empty": true }, { "frame_idx": 6, "slug": "topwear", "label": "L06 トップス / Topwear", "prompt_head": "Topwear", "path": "showcase/layers/06_topwear.png", "alpha_coverage_pct": 2.511, "alpha_min": 0, "alpha_max": 255, "tight_bbox": [ 265, 180, 401, 318 ], "bbox_w": 137, "bbox_h": 139, "non_empty": true }, { "frame_idx": 7, "slug": "arms_hands", "label": "L07 腕・袖・手 / Arms & Hands", "prompt_head": "Arms, Sleeves and Hands", "path": "showcase/layers/07_arms_hands.png", "alpha_coverage_pct": 4.388, "alpha_min": 0, "alpha_max": 255, "tight_bbox": [ 89, 206, 579, 437 ], "bbox_w": 491, "bbox_h": 232, "non_empty": true }, { "frame_idx": 8, "slug": "bottomwear", "label": "L08 スカート / Bottomwear", "prompt_head": "Bottomwear", "path": "showcase/layers/08_bottomwear.png", "alpha_coverage_pct": 4.069, "alpha_min": 0, "alpha_max": 255, "tight_bbox": [ 227, 302, 437, 473 ], "bbox_w": 211, "bbox_h": 172, "non_empty": true }, { "frame_idx": 9, "slug": "legs_footwear", "label": "L09 脚・靴 / Legs & Footwear", "prompt_head": "Legs and Footwear (Both)", "path": "showcase/layers/09_legs_footwear.png", "alpha_coverage_pct": 7.239, "alpha_min": 0, "alpha_max": 255, "tight_bbox": [ 246, 424, 420, 866 ], "bbox_w": 175, "bbox_h": 443, "non_empty": true }, { "frame_idx": 10, "slug": "back_hair", "label": "L10 後ろ髪 / Back Hair", "prompt_head": "Back Hair", "path": "showcase/layers/10_back_hair.png", "alpha_coverage_pct": 4.47, "alpha_min": 0, "alpha_max": 255, "tight_bbox": [ 203, 57, 464, 357 ], "bbox_w": 262, "bbox_h": 301, "non_empty": true }, { "frame_idx": 11, "slug": "background", "label": "L11 背景 / Background", "prompt_head": "Background", "path": "showcase/layers/11_background.png", "alpha_coverage_pct": 100.0, "alpha_min": 252, "alpha_max": 255, "tight_bbox": [ 0, 0, 671, 895 ], "bbox_w": 672, "bbox_h": 896, "non_empty": true } ]}123version https://git-lfs.github.com/spec/v1oid sha256:8b5baa1aad9a619bee150ccc45dfcca2476cbc7c76e1f6aa3f47b1eb728ea46asize 3182500123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620{
"last_node_id": 13,
"last_link_id": 14,
"nodes": [
{
"id": 1,
"type": "UNETLoader",
"pos": [
40,
40
],
"size": [
420,
82
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
1
]
}
],
"properties": {
"Node name for S&R": "UNETLoader"
},
"widgets_values": [
"ming_image_0.2_design_layer_yebisu_int8_bf16mix.safetensors",
"default"
]
},
{
"id": 2,
"type": "CLIPLoader",
"pos": [
40,
170
],
"size": [
420,
106
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "CLIP",
"type": "CLIP",
"links": [
3
]
}
],
"properties": {
"Node name for S&R": "CLIPLoader"
},
"widgets_values": [
"ming_image_0.2_ling_mini_2.0_layer_yebisu_int8_bf16mix.safetensors",
"lumina2",
"default"
]
},
{
"id": 3,
"type": "VAELoader",
"pos": [
40,
320
],
"size": [
420,
58
],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "VAE",
"type": "VAE",
"links": [
6,
7
]
}
],
"properties": {
"Node name for S&R": "VAELoader"
},
"widgets_values": [
"ming_image_vae_bf16.safetensors"
]
},
{
"id": 4,
"type": "LoadImage",
"pos": [
40,
420
],
"size": [
320,
314
],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
4
]
},
{
"name": "MASK",
"type": "MASK",
"links": null
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"input_vtuber.png",
"image"
]
},
{
"id": 5,
"type": "ImageScale",
"pos": [
420,
420
],
"size": [
315,
130
],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 4
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
5
]
}
],
"properties": {
"Node name for S&R": "ImageScale"
},
"widgets_values": [
"lanczos",
672,
896,
"disabled"
]
},
{
"id": 6,
"type": "ModelSamplingFlux",
"pos": [
520,
40
],
"size": [
315,
130
],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 1
}
],
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [
2
]
}
],
"properties": {
"Node name for S&R": "ModelSamplingFlux"
},
"widgets_values": [
1.15,
0.5,
672,
896
]
},
{
"id": 7,
"type": "TextEncodeMingImageEdit",
"pos": [
520,
210
],
"size": [
420,
340
],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{
"name": "clip",
"type": "CLIP",
"link": 3
},
{
"name": "images.image_1",
"shape": 7,
"type": "IMAGE",
"link": 5
},
{
"name": "vae",
"shape": 7,
"type": "VAE",
"link": 6
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
8,
9
]
}
],
"properties": {
"Node name for S&R": "TextEncodeMingImageEdit"
},
"widgets_values": [
"Decompose this image into 11 layers with the following specifications:\n\nNumber of layers: 11\nLayer 1: Front Hair. Silver-white center-parted front hair and cheek-framing side locks bordering the forehead and temples without covering the eyebrows.\nLayer 2: Eyes. Large vivid sapphire-blue anime eyes with crisp black upper eyelashes, dark pupils, glowing white specular highlights, sclera, and subtle lower lid shading.\nLayer 3: Eyebrows. Two thin, clean, gently arched silver-gray eyebrows positioned clearly above each eye.\nLayer 4: Mouth. A small, clean curved closed-mouth smile centered on the lower face.\nLayer 5: Head (Source Base). Fair peach skin base forming the face, chin, ears, and neck with crisp dark outline, excluding eyes, eyebrows, mouth, and hair.\nLayer 6: Topwear. Cropped dark navy idol jacket with crimson lapels, gold piping, shoulder epaulettes, small chest crest badge, white collared buttoned blouse, and crimson neck bow tie with a gold center clasp.\nLayer 7: Arms, Sleeves and Hands. Both outstretched 45-degree dark navy sleeves ending in red-and-white bands, detached navy wrist cuffs with gold buttons, bare forearms, and open five-finger hands.\nLayer 8: Bottomwear. High-waisted dark navy pleated mini skirt featuring a gold-buttoned waist band, double gold horizontal stripes along the skirt hem, and crimson under-pleats.\nLayer 9: Legs and Footwear (Both). Both unoccluded legs showing upper thighs, sheer dark charcoal thigh-high stockings with lace tops, and glossy black Mary Jane platform shoes.\nLayer 10: Back Hair. Long voluminous silver-white twin-tails fading into pastel lavender curled tips, secured by red ribbon hair ties and flowing behind the shoulders and upper arms.\nLayer 11: Background. Plain, solid pure white backdrop with no gradients, cast shadows, or markings."
]
},
{
"id": 8,
"type": "ConditioningZeroOut",
"pos": [
980,
310
],
"size": [
220,
46
],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{
"name": "conditioning",
"type": "CONDITIONING",
"link": 8
}
],
"outputs": [
{
"name": "CONDITIONING",
"type": "CONDITIONING",
"links": [
10
]
}
],
"properties": {
"Node name for S&R": "ConditioningZeroOut"
}
},
{
"id": 9,
"type": "EmptyQwenImageLayeredLatentImage",
"pos": [
980,
410
],
"size": [
320,
130
],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
11
]
}
],
"properties": {
"Node name for S&R": "EmptyQwenImageLayeredLatentImage"
},
"widgets_values": [
672,
896,
11,
1
]
},
{
"id": 10,
"type": "KSampler",
"pos": [
1340,
140
],
"size": [
315,
262
],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{
"name": "model",
"type": "MODEL",
"link": 2
},
{
"name": "positive",
"type": "CONDITIONING",
"link": 9
},
{
"name": "negative",
"type": "CONDITIONING",
"link": 10
},
{
"name": "latent_image",
"type": "LATENT",
"link": 11
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
12
]
}
],
"properties": {
"Node name for S&R": "KSampler"
},
"widgets_values": [
42,
"fixed",
12,
2.0,
"euler",
"simple",
1.0
]
},
{
"id": 11,
"type": "LatentCutToBatch",
"pos": [
1700,
140
],
"size": [
260,
82
],
"flags": {},
"order": 10,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 12
}
],
"outputs": [
{
"name": "LATENT",
"type": "LATENT",
"links": [
13
]
}
],
"properties": {
"Node name for S&R": "LatentCutToBatch"
},
"widgets_values": [
"t",
1
]
},
{
"id": 12,
"type": "VAEDecode",
"pos": [
2000,
140
],
"size": [
210,
46
],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{
"name": "samples",
"type": "LATENT",
"link": 13
},
{
"name": "vae",
"type": "VAE",
"link": 7
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
14
]
}
],
"properties": {
"Node name for S&R": "VAEDecode"
}
},
{
"id": 13,
"type": "SaveImage",
"pos": [
2250,
140
],
"size": [
320,
270
],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 14
}
],
"outputs": [],
"properties": {
"Node name for S&R": "SaveImage"
},
"widgets_values": [
"ming_layer_output"
]
}
],
"links": [
[
1,
1,
0,
6,
0,
"MODEL"
],
[
2,
6,
0,
10,
0,
"MODEL"
],
[
3,
2,
0,
7,
0,
"CLIP"
],
[
4,
4,
0,
5,
0,
"IMAGE"
],
[
5,
5,
0,
7,
1,
"IMAGE"
],
[
6,
3,
0,
7,
2,
"VAE"
],
[
7,
3,
0,
12,
1,
"VAE"
],
[
8,
7,
0,
8,
0,
"CONDITIONING"
],
[
9,
7,
0,
10,
1,
"CONDITIONING"
],
[
10,
8,
0,
10,
2,
"CONDITIONING"
],
[
11,
9,
0,
10,
3,
"LATENT"
],
[
12,
10,
0,
11,
0,
"LATENT"
],
[
13,
11,
0,
12,
0,
"LATENT"
],
[
14,
12,
0,
13,
0,
"IMAGE"
]
],
"groups": [],
"config": {},
"extra": {},
"version": 0.4
}.gitattributes+17
README.md+56-1
scripts/layers_to_psd.pyAdded+610
showcase/decomposition_report.jsonAdded+258
showcase/input_vtuber.pngAdded

Large File Pointer Details
- SHA256: 3f5a3171507ee01ef7e2a8cf3c9ebc4c7d5d294805b6accb8c2c9bbe0d6334b5
- Pointer size: 132 Bytes
- Size of remote file: 1.21 MB
showcase/layers/00_composite.pngAdded

Large File Pointer Details
- SHA256: e2bc2ad62747e324e38b425f0466e987382f83ff5336c987e050692ef2f2e5af
- Pointer size: 131 Bytes
- Size of remote file: 607 kB
showcase/layers/01_front_hair.pngAdded

Large File Pointer Details
- SHA256: 3cab72fcc768acea9fd623151caf912ea9fb43a542b7daad00f4132a6123d8bb
- Pointer size: 131 Bytes
- Size of remote file: 287 kB
showcase/layers/02_eyes.pngAdded

Large File Pointer Details
- SHA256: 82ba049d8ce300138c842955ee5308e680ac1f044f3904094e891dc33de85b33
- Pointer size: 131 Bytes
- Size of remote file: 232 kB
showcase/layers/03_eyebrows.pngAdded

Large File Pointer Details
- SHA256: 062585be2f9bc19e6a6441321460a5024596236fddb67fa06804b56f32429a2a
- Pointer size: 131 Bytes
- Size of remote file: 191 kB
showcase/layers/04_mouth.pngAdded

Large File Pointer Details
- SHA256: 7d0a9982d20a89c1ddfb906bd3ce51f0257861a6bb8f3c61caa10e6c10a7595e
- Pointer size: 131 Bytes
- Size of remote file: 186 kB
showcase/layers/05_head_base.pngAdded

Large File Pointer Details
- SHA256: cf8cfb3162d3602a16643159585fc193bd8ee7f9b6a111de2810adcad10864dc
- Pointer size: 131 Bytes
- Size of remote file: 258 kB
showcase/layers/06_topwear.pngAdded

Large File Pointer Details
- SHA256: 5e2afc9cc7b2e668869d99c6200441323d3e21cf2a12ac27b1ee6321fa265061
- Pointer size: 131 Bytes
- Size of remote file: 302 kB
showcase/layers/07_arms_hands.pngAdded

Large File Pointer Details
- SHA256: 3243870764ff4535680a2641a1b289aa2233ce375dd04ce6494d0946054337c4
- Pointer size: 131 Bytes
- Size of remote file: 294 kB
showcase/layers/08_bottomwear.pngAdded

Large File Pointer Details
- SHA256: 31b349ea11e5964aab7e8475ec17abaa0884b633aa4c394611914f1da4a22bef
- Pointer size: 131 Bytes
- Size of remote file: 316 kB
showcase/layers/09_legs_footwear.pngAdded

Large File Pointer Details
- SHA256: 169f80b3c500dc0c9fe3e8f860d37c6e6505c0200135c6d19c0b7c79622fcb50
- Pointer size: 131 Bytes
- Size of remote file: 267 kB
showcase/layers/10_back_hair.pngAdded

Large File Pointer Details
- SHA256: e4184d911e9cd67e9044de8a81f7bc6eb43b920d87aaaa72155ee20539f681ea
- Pointer size: 131 Bytes
- Size of remote file: 278 kB
showcase/layers/11_background.pngAdded

Large File Pointer Details
- SHA256: 374123146b6e6e7eb02d307fb1067eddb29b8b0dd30884aa545c6860553feb16
- Pointer size: 131 Bytes
- Size of remote file: 295 kB
showcase/vtuber_11layers_live2d.psdAdded
Large File Pointer Details
- SHA256: 927d869efc5df0cee6826ea47cad289f33b0b904c3b94fed2b56d2c8bcd0986d
- Pointer size: 132 Bytes
- Size of remote file: 2.51 MB
showcase/vtuber_all_layers_showcase.pngAdded

Large File Pointer Details
- SHA256: 0d64a042b02b99f82f8f32b92c93571d070a6acdab649b302e84d160f8510874
- Pointer size: 132 Bytes
- Size of remote file: 1.31 MB
showcase/vtuber_layer_showcase.mp4Added+3
showcase/vtuber_parts_closeup_sheet.pngAdded

Large File Pointer Details
- SHA256: 92d7a2aa93ff1bb3faed87f5d2f79529890d55a0e9e54c381bd8752262520d78
- Pointer size: 131 Bytes
- Size of remote file: 589 kB
workflows/ming_image_0.2_design_layer_vtuber_rigging.jsonAdded+620