MOSS-Image: Text-to-Image Generation
with Native Layout Control

OpenMOSS Team

MOSS-Image-Base and MOSS-Image-SFT teaser

MOSS-Image is a text-to-image model family from OpenMOSS, comprising a base model and a curated-data fine-tuned model. In addition to natural-language prompts, MOSS-Image supports native text-driven layout generation: objects, rendered text, and their spatial positions can be specified in a JSON prompt. The family combines a compact 5B backbone, prompts of up to 4K tokens, strong text rendering, and versatile anime and photorealistic styles. Python and Gradio interfaces use a shared Diffusers pipeline.

News

— Introducing MOSS-Image-Base, with code and model weights available.

Layout control, strong text rendering, prompts of up to 4K tokens, anime and photorealistic styles, and a 5B backbone designed for efficient generation and fine-tuning. Training uses heterogeneous GPU platforms.

Features

Text-to-Image Generation

Generate images from natural-language descriptions with MOSS-Image-Base or MOSS-Image-SFT, using a shared inference interface.

Native Layout Control

Specify a scene, its objects, and text with a structured JSON prompt. Bounding boxes describe the position and size of individual elements.

Compact, Adaptable Backbone

A 5B backbone supports prompts of up to 4K tokens and fine-tuning for custom tasks and domains. Model weights are licensed under Apache-2.0.

Showcases

Text, illustration, photography and visual design, composed as in the project showcase. Open either image to explore it at full resolution.

MOSS-Image examples overview: first showcase composition MOSS-Image examples overview: second showcase composition

Layout-to-Image Generation

Layouts also support controlled editing and user-friendly layout tools. Edit text, element descriptions and bounding boxes to adjust image content and composition in a structured way.

MOSS-Image accepts layout specifications through the same prompt interface used for text-to-image generation. The generated result below illustrates layout control; the JSON example that follows describes a travel poster with a title and a mountain illustration.

Generated layout-control example with annotated bounding boxes
Layout-control result from the project README. Open the figure for the vector annotations.
Input layout1024 × 1024
−512+512
textEXPLORE
objectBlue mountain
illustration
+

Bounding-box visualization · input specification only

Structured prompt
{
  "summary": {
    "meta": ["poster"],
    "canvas": "single",
    "caption": "A minimalist travel poster with a cream background, a blue mountain illustration, and the title EXPLORE at the top."
  },
  "items": [
    {
      "label": "text",
      "caption": "Large dark-blue uppercase title centered at the top.",
      "text": "EXPLORE",
      "bbox": [-416, -384, -288, 384]
    },
    {
      "label": "object",
      "caption": "A flat blue mountain illustration in the lower center.",
      "bbox": [-192, -288, 384, 288]
    }
  ],
  "bbox_coord_space": "abs_centralized",
  "bbox_format": "yxyx"
}
Coordinates follow [y_min, x_min, y_max, x_max] and are measured in pixels relative to the canvas center. The diagram visualizes the input layout, not a model-generated result.
Run this layout example

Paste the JSON above into Gradio’s Prompt field and set width and height to 1024. With the Python pipeline below, load the JSON and pass it as the prompt:

import json
from pathlib import Path

layout = json.loads(Path("layout.json").read_text())
image = pipe(
    json.dumps(layout, ensure_ascii=False),
    height=1024, width=1024,
    num_inference_steps=50, guidance_scale=3.0,
    uncond_skip_layers=[22],
    generator=torch.Generator("cpu").manual_seed(42),
).images[0]
image.save("layout.png")

Models

The two checkpoints share the same architecture and sampling interface.

ModelDescriptionWeights
MOSS-Image-BaseBase text-to-image modelHugging Face ↗ · ModelScope ↗
MOSS-Image-SFTFine-tuned from MOSS-Image-Base on curated dataHugging Face ↗ · ModelScope ↗

Weights: Apache-2.0. The pipeline code and third-party components retain their respective licenses.

Base vs. SFT

In this example, SFT produces clearer text grouping and a more organized whiteboard layout.

MOSS-Image-Base
Whiteboard generated by MOSS-Image-Base
MOSS-Image-SFT
Whiteboard generated by MOSS-Image-SFT

Quick Start

Use Python 3.10+ and an NVIDIA GPU. In a dedicated Python environment, install a PyTorch build compatible with your CUDA environment, then run:

Installation
git clone https://github.com/OpenMOSS/MOSS-Image.git
cd MOSS-Image
python -m venv .venv
source .venv/bin/activate

pip install -r requirements.txt
Python · Diffusers
import torch
from diffusers import DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained(
    "OpenMOSS-Team/MOSS-Image-Base",
    custom_pipeline="pipeline_moss_image",
    trust_remote_code=True,
    torch_dtype={"default": torch.bfloat16, "vae": torch.float32},
)
pipe.scheduler = type(pipe.scheduler).from_config(pipe.scheduler.config)
pipe.to("cuda")
image = pipe(
    "A wide view of a refrigerator beside a kitchen counter with a fruit bowl. A small sticky note on the refrigerator door is handwritten in Chinese:“\n记得买牛奶和鸡蛋!\n牛奶两盒,鸡蛋一打。\n顺便带一袋面包。”",
    height=1456,
    width=1456,
    num_inference_steps=50,
    guidance_scale=3.0,
    uncond_skip_layers=[22],
    generator=torch.Generator("cpu").manual_seed(42),
).images[0]
image.save("refrigerator_note.png")

For prompts, layout inputs and LoRA training guidance, see the English user guide or 中文用户指南.

Run Gradio locally
pip install -e '.[ui]'
python gradio_app.py --model OpenMOSS-Team/MOSS-Image-Base

Advanced settings offer GPU resident, Component, and Sequential memory modes. If memory is insufficient, select Sequential or reduce image size. Compile DiT is disabled by default and unavailable in Sequential mode.

Recommended sampling settings
Sampler
Flow-matching Euler
Steps / CFG / shift
50 / 3 / 5
Layer skipping
Negative-branch skipping at layer 22
Negative prompt
Empty in the Python API

ComfyUI

Install the native plugin by searching for MOSS-Image in ComfyUI Manager. Integration into the official ComfyUI repository is in progress.

Installation and usage ↗ · Example workflow ↗

Prompt Enhancer

Turn image ideas into detailed captions or spatial Layout prompts with the MOSS-Image Prompt Enhancer skill, designed for GPT-6-family agents with local file and Python tools.

The bundled script converts pixel-coordinate drafts into compact JSON with integer centered coordinates. It prepares prompts without calling an image-generation service.

  1. Install the skill folder in your agent’s skills directory.
  2. Invoke $moss-image-prompt-enhancer with your image idea, caption or Layout output requirements, and canvas dimensions.
  3. Paste the compiled result into MOSS-Image’s positive prompt. For Layout prompts, use the same generation dimensions as the draft.

Prompt Enhancer instructions ↗

Citation

If you use MOSS-Image in your research, please cite the project repository.

BibTeX
@misc{mossimage2026,
  title = {MOSS-Image},
  author = {{OpenMOSS Team}},
  year = {2026},
  howpublished = {\url{https://github.com/OpenMOSS/MOSS-Image}}
}