MOSS-Image Prompt Enhancer
An Ollama model that turns short image ideas into detailed prompts for the MOSS-Image text-to-image model.
It is based on the official moss-image-prompt-enhancer skill, packaged as a local model so it can run offline without an agent.
What it does
Give it a rough idea, get back only the enhanced prompt (no preamble, no explanations).
| Mode | Used for | Output |
|---|---|---|
| Caption (default) | Photos, portraits, landscapes, illustrations, paintings | One cohesive English prose description |
| Layout | Posters, infographics, multi-panel images, exact text placement | A JSON draft with pixel bounding boxes |
Behavior:
- Keeps your intent: subject, style, counts, exclusions, and exact visible text are preserved.
- Avoids filler: no quality-tag lists, no negative prompts, no invented slogans or watermarks. Minimalist requests stay minimalist.
- People always get an age and an ethnicity. If you give them, they are used exactly. If not, they are inferred from context (a Seoul night market gives Korean, "grandmother" gives elderly). With no clues the model picks one.
- Honors an explicit mode ("Layout mode, 1024x1536: ...", "Caption mode: ...") and an explicit canvas size.
See examples/outputs.md for real outputs.
Requirements
- Ollama
- Enough memory for the base model,
huihui_ai/qwen3-abliterated:8b(about 5 GB download; roughly 8 GB of RAM or VRAM is comfortable) - Python 3, only if you use Layout mode (see below)
Run directly from Ollama
To run the model directly from Ollama.com, use the following command:
ollama pull DutchIT/moss-image-prompt-enhancer
ollama run DutchIT/moss-image-prompt-enhancer "a woman reading in a cafe"
pull downloads the model once; run also pulls it automatically if it is missing. The download contains the base model weights plus this project's system prompt and parameters, and no new weights.
Install
git clone https://github.com/royen99/moss-image-prompt-enhancer
cd moss-image-prompt-enhancer
ollama create moss-prompt-enhancer -f Modelfile
The first run downloads the base model. Re-run the same command after editing the Modelfile; unchanged layers are reused.
Usage
ollama run moss-prompt-enhancer "a woman reading in a cafe"
Or through the API:
curl http://127.0.0.1:11434/api/generate -d '{
"model": "moss-prompt-enhancer",
"prompt": "a street food vendor at a night market in Seoul",
"stream": false
}'
Paste the result into MOSS-Image (for example in ComfyUI) as the positive prompt.
Caption mode
Just describe the image:
a grandmother knitting by a window, watercolor style
Layout mode
Ask for it explicitly, or use a poster, infographic, or multi-panel idea. State the canvas size if you care about it:
Layout mode, 1024x1536: a jazz concert poster. Title "SUMMER JAZZ NIGHT", below it "Friday 8 PM\nBlue Door Cafe". A saxophone player in the middle.
The model returns a draft with plain pixel boxes (bbox_coord_space: "abs", bbox_format: "xyxy", [x_min, y_min, x_max, y_max] from the top-left). MOSS-Image expects centered yxyx coordinates, so the draft must be compiled before use. The official skill ships the compiler:
python3 compile_prompt.py draft.json --output prompt.txt
Get compile_prompt.py from the skill's scripts folder. It rejects invalid or out-of-bounds boxes. Use the width and height from the draft as the image size when generating. The compiled prompt itself does not contain the dimensions.
The model is not asked to do the coordinate arithmetic because small models get it wrong.
Usage in ComfyUI
For usage within ComfyUI I would recommend using the simple comfyui-ollama node without any special settings. Simply connect a input textbox to the prompt connector (no system prompt input needed).
Image-to-image (Modelfile.i2i)
Modelfile.i2i builds a second model that looks at an image and writes a MOSS-Image prompt for it, so you can recreate or modify an existing picture. It uses the vision base model huihui_ai/qwen3-vl-abliterated:8b-instruct (about 6 GB). It must be the -instruct variant: the default qwen3-vl-abliterated tag is a thinking model that spends thousands of tokens reasoning and can return an empty answer.
Install
ollama create moss-prompt-enhancer-i2i -f Modelfile.i2i
The first run downloads the vision base model.
Three ways to use it
1. Describe an image (Caption mode, the default). Put the image path in the prompt, after the instruction:
ollama run moss-prompt-enhancer-i2i "Describe this image. ./photo.png"
The result is one prose prompt that covers the subject, composition, lighting, style, exact visible text, counts, and the apparent age and ethnicity of people.
2. Describe it with a change. Add what should be different; everything else is kept and the full prompt for the modified image is returned:
ollama run moss-prompt-enhancer-i2i "make it a rainy evening and change her sweater to red ./photo.png"
3. Get a Layout (best for images with text or several distinct elements). Ask for layout mode and give the size of the image you want to generate:
ollama run moss-prompt-enhancer-i2i "Layout mode, 736x1120 ./poster.png"
Copy the JSON it prints into draft.json. The model measures boxes on a normalized 0-1000 grid, so the draft has to be converted to pixels and then compiled:
python scripts/to_pixels.py draft.json --output pixels.json
python compile_prompt.py pixels.json --output prompt.txt
compile_prompt.py is the official script from the MOSS-Image skill. Paste the contents of prompt.txt into MOSS-Image and generate at the same width and height you gave in the request.
Typical image-to-image flow
- Feed a real image to the model with
Layout mode, WIDTHxHEIGHT(or plain Caption mode). - Optionally edit the result: change a caption, move or delete an item, change visible text.
- Convert and compile the layout (layout mode only), or use the caption as is.
- Generate with MOSS-Image at the chosen size. The result is comparable to the source image, with your edits applied.
See examples/output-i2i.md for real images and the layouts generated from them.
Notes
- Text and the main subjects are located accurately. The model often adds extra items for scenery (lights, crowd, sky); delete those you don't need before compiling.
- It does not always state an age or ethnicity for people; add them to your instruction if you need them.
- Unreadable or garbled text in the source image may be transcribed literally.
In ComfyUI
Use the comfyui-ollama node with an image input, the model name moss-prompt-enhancer-i2i, and your instruction as the prompt. Feed the returned text (or the compiled layout) into the MOSS-Image prompt input.
Settings
Defined in the Modelfile:
| Parameter | Value | Why |
|---|---|---|
temperature |
0.7 | Some creative variety |
top_p / top_k |
0.8 / 20 | Qwen3 recommended non-thinking sampling |
num_ctx |
8192 | Fits the system prompt, examples, and output |
num_predict |
2048 | Caps runaway output |
The Modelfile holds the full system prompt and a few example conversations (few-shot) that teach the layout format.
Project layout
Modelfile system prompt, parameters, few-shot examples
Modelfile.i2i image-to-prompt variant (vision base model)
scripts/
to_pixels.py converts i2i Layout boxes (0-1000 grid) to pixels
examples/
inputs.jsonl 20 test prompts with expected mode and focus checks
outputs.md real model outputs and known issues
output-i2i.md image-to-image examples (real image, generated layout)
images/ optional generated images for the examples
tests/
evaluation.md manual checklist for scoring outputs
Testing
Run each prompt from examples/inputs.jsonl against the model and score the result with tests/evaluation.md. Because the model is sampled, run each prompt a few times.
Known limitations
This runs on an 8B model, so rule-following is imperfect. Observed issues are listed in examples/outputs.md. In short:
- Ethnicity is always stated, but "random" choices lean toward a few defaults.
- Characters in Layout mode are sometimes labeled
objectinstead ofcharacter. - A prompt like "write the prompt in Chinese: ..." can return unrelated text.
- The model occasionally invents visible text, such as a sign in a bar scene.
- Layout boxes are plausible but not always well composed. Check them before compiling.
A larger base model follows the rules more reliably. To try one, change the FROM line in the Modelfile.
About the base model
The default base model, huihui_ai/qwen3-abliterated:8b, is a Qwen3 variant with its refusal behavior removed. That keeps it from refusing ordinary creative prompts, but it also means the model has no built-in safety filtering. The system prompt does not add content restrictions. Add your own if you plan to expose the model to other people.
If it prints <think> blocks, disable thinking (ollama run --think=false moss-prompt-enhancer, or /set nothink in a session).
Credits
- Prompting guidance and Layout schema: OpenMOSS/MOSS-Image,
skills/moss-image-prompt-enhancer. - Base model: huihui_ai/qwen3-abliterated, derived from Qwen3.
This project is not affiliated with OpenMOSS or Alibaba. Check the licenses of the upstream projects above before redistributing.
License
Licensed under the Apache License 2.0.
Model tree for DutchIT/moss-image-prompt-enhancer-i2i
Base model
Qwen/Qwen3-VL-8B-Instruct