MOSS AnyPaint provides arbitrary-mask inpainting, outpainting, and image editing for MOSS-Image-Base. One runtime handles internal edits, canvas extension, disconnected regions, narrow structures, and mixed masks that cross the source boundary.
Download the LoRA | ComfyUI nodes | ComfyUI releases
| Source | Generated mask | AnyPaint result |
|---|---|---|
Important: The Hugging Face auto-generated Diffusers snippet and ordinary LoRA importers are not compatible with this functional adapter. Use the included
example.py,pipeline.py, andanypaint.py.
White mask pixels are generated or edited. Black mask pixels are preserved. The helper also marks every pixel outside the placed source as generated, so the same input contract covers both inpainting and outpainting.
All showcase sources are synthetic, generated from the unmodified Krea 2 base model with original prompts. They contain no real-person identity, brand, existing fictional character, or other third-party character IP. The sources are also used in the Krea 2 AnyPaint showcase; the results here use MOSS AnyPaint.
The showcase covers photographic, illustrated, 3D, indoor, outdoor, object, and
human-subject compositions. Every case ships with its source, exact binary
mask, output, and generation metadata under showcase/.
| Source | Generated mask | AnyPaint result |
|---|---|---|
Prompt: a sunlit modern kitchen interior with a handmade ceramic bowl of fresh lemons on the center island, coherent morning light, complete architectural photograph
| Source | Generated mask | AnyPaint result |
|---|---|---|
Prompt: an original watercolor greenhouse and coastal garden, the path and flowering plants continuing naturally downward, airy washes, complete vertical composition
| Source | Generated mask | AnyPaint result |
|---|---|---|
Prompt: an original retro-futuristic exploration rover crossing a colorful alien desert, distant mineral formations extending to the right, stylized 3D cinematic render
| Source | Generated mask | AnyPaint result |
|---|---|---|
Prompt: an original adult woman with short silver hair wearing a richly textured coral coat in a spacious contemporary gallery, complete full-body fashion photograph
| Source | Generated mask | AnyPaint result |
|---|---|---|
Prompt: an original botanical field illustration of blue and white meadow flowers with three small honeybees hovering naturally between the blossoms, delicate wings, fine paper texture, naturalistic painted details
| Source | Generated mask | AnyPaint result |
|---|---|---|
Prompt: an original sculptural brushed aluminum desk lamp with a vivid orange braided power cable extending from the lamp across the tabletop, premium neutral product photography
| Source | Generated mask | AnyPaint result |
|---|---|---|
Prompt: an original alpine valley after rain with clusters of luminous rainbow-colored fantasy mushrooms growing along the winding riverbanks and foreground rocks, subtle magical glow reflected in wet stone, coherent wide cinematic landscape photograph
| Source | Generated mask | AnyPaint result |
|---|---|---|
Prompt: a polished portrait of an adult woman with shoulder-length auburn hair, a dark green enamel hair clip above her left ear and matching small geometric earrings, simple cream blouse, coherent natural daylight and pale gray studio background
| Source | Generated mask | AnyPaint result |
|---|---|---|
Prompt: an overhead catalog photograph with a pair of deep forest-green suede sneakers on the left and a cobalt-blue structured leather shoulder bag on the right, refined minimal hardware, balanced composition, coherent soft studio shadows
| Source | Generated mask | AnyPaint result |
|---|---|---|
Prompt: a clean oak writing desk in a softly lit home office with a handmade dark green ceramic mug on the left side and a small potted succulent in a matte white planter on the right, coherent restrained contemporary interior photograph
| Source | Generated mask | AnyPaint result |
|---|---|---|
Prompt: a bright neutral living room with a tall brushed-brass floor lamp beside the left end of the cream sofa and a round woven storage basket beside the right end, simple coffee table, coherent warm daylight and understated architectural photography
| Source | Generated mask | AnyPaint result |
|---|---|---|
Prompt: a quiet contemporary reading room whose large central picture window overlooks a snowy mountain lake beneath a clear pale-blue winter sky, armchair in the foreground, coherent daylight, reflections and realistic interior photography
The runtime takes:
(x0, y0, x1, y1) in output pixels;Use a source bounding box with the source's aspect ratio to avoid stretching. A source-sized mask follows the source's scaling, offset and clipping. A canvas-sized mask is used directly; if source and canvas sizes are equal, canvas coordinates take priority. Areas outside the source box are always generated. Other mask sizes are rejected.
The complete masked canvas is encoded as one maximum-edge-384 reference whose rotary coordinates cover the full target canvas. A full-resolution known image and keep mask separately preserve reliable unmasked latent tokens after every flow step. Exterior source seams have a 32-pixel inward redraw band; internal masks are exact. The returned image is the raw decoded model output; there is no hidden post-generation source composite. The text encoder receives only the prompt, without VLM image encoding.
| Setting | Value |
|---|---|
| Inference base | OpenMOSS-Team/MOSS-Image-Base + Base 8-step DMD2 |
| Steps | 8 |
| CFG / shift | 1 / 5 |
| LoRA scale | 1.0 for both adapters |
| Frozen DiT / text weights | Quanto qfloat8 |
| Compute / task adapter | BF16 |
| VAE / DMD2 adapter | FP32; DMD2 remains unmerged |
| Reference maximum edge | 384 px |
| Boundary redraw band | 32 px at exterior source seams; 0 px for internal masks |
| Reference VLM encoding | disabled |
| Reference K/V cache | enabled |
Use lora_dmd2.safetensors from the Base 8-step DMD2 repository, rather than
SFT weights or its earlier lora.safetensors. Required upstream revisions and
dependencies are recorded in runtime_lock.json.
Use Python 3.11+ and a CUDA GPU with BF16 support. Install the PyTorch wheel appropriate for your CUDA environment before the remaining requirements.
pip install huggingface_hub
hf download yijunwang2/moss-anypaint --local-dir moss-anypaint
cd moss-anypaint
pip install -r requirements.txt
python example.py \
--source input.webp \
--mask mask.png \
--output result.webp \
--width 1536 \
--height 1024 \
--bbox 0 0 1024 1024 \
--prompt "a bright modern studio, complete coherent composition"
For pure inpainting, omit --bbox and use a source image matching the output
canvas. For outpainting, provide the source location in the larger canvas. The
mask may additionally select any internal areas to regenerate.
The first run downloads the Base components and Base 8-step DMD2 adapter.
Already-downloaded assets can be supplied with --model-dir and --distillation.
Use moss_anypaint_rank32.safetensors as the task adapter. An ordinary
text-to-image LoRA loader alone does not implement the AnyPaint input contract.
See the step-by-step ComfyUI instructions for same-canvas inpainting, outpainting, SAM/other MASK nodes, Mask Editor and separate mask images. The default workflow uses one Load Image node for its IMAGE and MASK outputs; all padding defaults to 0. Existing saved workflows retain their saved padding.
Use reference images only when you have the subject's consent or another lawful basis to use them. Do not use this model for deceptive impersonation, fraud, harassment, non-consensual intimate imagery, biometric identification, or misleading political or media content.
Deployments must follow applicable upstream terms, implement appropriate content moderation, and disclose AI-generated content where required.
The LoRA weights and included runtime are released under Apache License 2.0. See LICENSE, PIPELINE_LICENSE, NOTICE, and component licenses and attribution.
Base: OpenMOSS-Team/MOSS-Image-Base. Runtime dependency: DiffSynth-Studio. Distillation: Base 8-step DMD2. This is an unofficial community release and is not endorsed by those authors. Training data is not included.
OpenMOSS-Team/MOSS-Image-Base