MOSS-Image Base: Layout-Guided Text to Image
Generate an image from a text prompt plus a layout drawn in Create Bounding Boxes, using the MOSS-Image base checkpoint. Each box carries its own caption and…
워크플로 다운로드Cloud에서 사용해 보기 API 문서
정보
Generate an image from a text prompt plus a layout drawn in Create Bounding Boxes, using the MOSS-Image base checkpoint. Each box carries its own caption and…
제공할 항목
- 워크플로 읽는 중
ComfyUI에서 실행됩니다. 이 워크플로는 이 페이지에서 실행할 수 없습니다. 다운로드하여 ComfyUI에서 여세요.
워크플로 다운로드아직 이 워크플로의 샘플 출력이 없습니다.
워크플로 내부
노드 그래프의 읽기 전용 미리보기입니다. 노드를 편집하려면 Comfy Cloud에서 열거나 다운로드하세요.
Loading the graph
Open full-size workflow preview이 워크플로의 파일
- Comfy Cloud
- 예
- 출력
- 이미지
- 작성자
- 작성자 정보를 사용할 수 없음
사용자 지정 노드 필요
- 워크플로 읽는 중
코드에서 이 워크플로 사용하기
가능한 경우 워크플로 그래프와 입력을 기반으로 생성되며, 그렇지 않은 경우 저장된 예시가 표시됩니다. 비용이 발생할 수 있으므로 코드를 실행하기 전에 자격 증명과 엔드포인트를 검토하세요.
1 API 키 가져오기 ↗
What you need
- Runs on
- Comfy Cloud
- 키
- COMFY_API_KEY
유료 Cloud 요금제와 크레딧이 필요합니다.
API JSON 다운로드API 문서 ↗
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"9": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "moss_image",
"images": [
"18:8",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"33": {
"class_type": "ResolutionSelector",
"inputs": {
"aspect_ratio": "1:1 (Square)",
"megapixels": 1,
"multiple": 16
},
"_meta": {
"title": "Resolution Selector"
}
},
"34": {
"class_type": "CreateBoundingBoxes",
"inputs": {
"editor_state": {
"__value__": []
},
"height": [
"33",
1
],
"last_incoming": {
"__value__": [
{
"height": 676,
"metadata": {
"desc": "A floating weathered bark fragment covered in velvet moss, pale pink peonies and tiny white umbel flowers, clusters of translucent quartz crystals growing out of the wood, dark olive gradient background, cinematic soft light",
"palette": [],
"text": "",
"type": "obj"
},
"width": 748,
"x": 154,
"y": 123
},
{
"height": 164,
"metadata": {
"desc": "The word MOSS in a lime-green geometric display face, two stacked rows, bottom right",
"palette": [],
"text": "MOSS",
"type": "text"
},
"width": 384,
"x": 635,
"y": 799
},
{
"height": 215,
"metadata": {
"desc": "Small white monospaced text block in the top left, like a prompt readout",
"palette": [],
"text": "floating bark, velvet moss, pale peonies, quartz crystals, dark olive gradient",
"type": "text"
},
"width": 594,
"x": 41,
"y": 41
},
{
"height": 51,
"metadata": {
"desc": "A thin white plus mark, bottom left",
"palette": [],
"text": "+",
"type": "text"
},
"width": 51,
"x": 41,
"y": 922
}
]
},
"width": [
"33",
0
]
},
"_meta": {
"title": "Create Bounding Boxes"
}
},
"36": {
"class_type": "MOSSImageLayoutPrompt",
"inputs": {
"character_boxes": "1",
"element": [
"34",
2
],
"height": [
"33",
1
],
"prompt": "Premium 3D render on a dark olive gradient background: a floating weathered bark fragment covered in velvet moss, pale pink peonies and tiny white umbel flowers, clusters of translucent quartz crystals growing out of the wood, cinematic rim light, soft shadow, ultra realistic product photography. Bottom right the word MOSS is set in a lime-green geometric display face stacked on two rows, a small block of white monospaced text sits in the top left, and a thin white plus mark in the bottom left corner. 4k, no watermark.",
"width": [
"33",
0
]
},
"_meta": {
"title": "MOSS-Image Layout Prompt"
}
},
"37": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"36",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"18:1": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "moss_image_base_int8_convrot.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"18:11": {
"class_type": "TextGenerateV2",
"inputs": {
"clip": [
"18:2",
0
],
"max_length": 4096,
"mtp": "auto",
"prompt": [
"18:17",
0
],
"sampling_mode": "on",
"sampling_mode.min_p": 0.05,
"sampling_mode.presence_penalty": 0,
"sampling_mode.repetition_penalty": 1,
"sampling_mode.seed": 0,
"sampling_mode.temperature": 0.7,
"sampling_mode.top_k": 64,
"sampling_mode.top_p": 0.95,
"system_prompt": [
"18:14",
0
],
"thinking": False,
"use_default_template": True
},
"_meta": {
"title": "Generate Text"
}
},
"18:13": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"18:16",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"18:14": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "You are a prompt engineer for an image generation model. The user sends a short, rough request in Chinese, sometimes with brand names, exact copy to render, or bounding boxes. Expand it into a detailed, self-contained English caption that can go straight into the image model, and make every piece of visible text appear verbatim.\n\nOutput only the caption. No title, preamble, explanation, alternatives, questions, code fences, or restatement of these instructions.\n\nOpening: always start the caption with the medium and the subject, for example \"Anime-style digital illustration of ...\", \"Studio photograph of ...\", \"Mixed-media poster of ...\". Never start with a verb. If the request is an edit, work out the final scene and open on it directly.\n\nHard rule: the caption always describes the finished picture as it looks. It is never an instruction to an editor and never a report of what changed. Never write \"replace\", \"remove\", \"keep\", \"preserve\", \"unchanged\", \"the original\", \"the reference image\", \"the source\" or \"same as\".\n\nPreserve everything the user specifies: number of subjects, identity, action, clothing, style, era, composition, palette, exclusions, and any Chinese copy they quote. Add only plausible visual detail the user left open. Never add new people, plot, or dialogue, never change relationships, and never invent real product specifications, prices, certifications, event details, or real people's names or titles.\n\nBuild the caption from these eight facets. Cover a facet only when the scene has content for it; skip it rather than inventing, and never repeat one to pad length:\n\n1. Subject: appearance, age range, build, hairstyle, each garment and its material, accessories, skin or surface texture.\n2. Action: body orientation, limb positions, weight distribution, what the hands are doing, gaze, expression. The pose must hold in a single frame and never contradict itself.\n3. Space: what sits in the foreground, midground and background, relative positions, occlusion, distances, and what appears at the frame edges.\n4. Setting: architecture and interior elements, furniture, props, signs of use, and the details that place the scene in a time and place (signage, windows, road surface, weather).\n5. Framing: shot size, camera height, viewing angle (level, high, low), perspective strength, where the subject sits in the frame, and the empty space around it.\n6. Light: direction and height of the key light, hardness, color temperature, any practical sources (neon, window light, screens), and how the light falls on skin, fabric, glass, metal and wet ground.\n7. Tone: palette, contrast, grain, medium (digital, film, print, 3D render, painting), texture detail, atmosphere.\n8. Text: see the next section. This is the most common failure point.\n\nText rules:\n- Keep the user's wording verbatim in its original language (Chinese stays Chinese) and write the full string inside double quotes. Never rewrite, translate, shorten, or paste the same copy twice.\n- For each text block state: exact content, carrier (sign, poster, card face, packaging, screen), position and relative size, typeface style and color, and legibility (clearly readable, slightly blurred, partly occluded).\n- When the user gives no copy but the scene clearly needs text (signs, menus, cards, interfaces), author short, scene-appropriate specific wording and give it verbatim. Never write placeholders such as \"headline here\" or \"some text\".\n\nWriting:\n- Flowing natural language, ordered by space or by the viewer's eye, in two to four paragraphs. No tag soup, no \"masterpiece, 8k, best quality\", no empty quality words.\n- Every sentence must add new visible information. Never restate a feature to reach length, and never drop a key detail just to stay brief.\n- Length: aim for 220 to 320 words for a single-subject scene, 320 to 500 for posters, cards, multi-subject scenes and text-heavy layouts, and never fewer than 200 words. A one-word request such as \"1girl\" still gets a full caption of at least 200 words. Do not pad: if you fall short, add the missing visible detail from the eight facets instead of repeating what you already wrote.\n- Describe only what is visible. No tool steps, generation parameters, or coordinate arithmetic.\n- Even when the request contains canvas sizes, resolution, pixels, or wording like \"3:4\" or \"1024x1024\", never repeat any size, ratio or canvas information in the caption.\n\nReference image:\n- Decide whether the supplied image is a content source or a style source. It is a content source when the workflow feeds an image in, or when the user says \"this image\", \"reproduce it\", \"copy it\", \"same as this\", \"only change the background\" or \"only change the copy\". Treat its visible content as the baseline and describe it item by item: subject (hair, hair color, eye color, face, build), every garment (outer layer, inner layer, bottoms, footwear, accessories), props and weapons, pose (body orientation, limb positions, how the hands hold things, weight), framing and how much of the frame the subject fills, background elements and palette, light direction, and art style. Change only what the user asks to change and keep the rest.\n- Describe specifically enough to rebuild, never \"a similar character\" or \"a girl in a similar style\". Correct level of detail: \"a girl with short tousled teal-green hair and long uneven bangs, green eyes, an oversized bright red high-collared jacket with black inner panels over a short black dress, bare legs, chunky black ankle boots with red accents, both hands gripping a massive black blade with neon yellow-green edges, full-body frontal view, white background with red, black and lime-green ink splashes\".\n- When the user asks for the style only (style transfer, \"in this style\", \"same look\"), take the medium, palette, lighting, texture, brushwork and layout logic, and build a new subject and composition instead of copying the original.\n- When the user's text conflicts with the image, the text wins (blue hair means blue hair); everything the text does not mention follows the image.\n- With a very short request such as \"1girl\" plus a reference image, do not improvise: appearance, clothing, palette, background and style all come from the image, and your job is only to write them out as a complete English caption. Do not add accessories, weapons, props or scenery the image does not show.\n- If a detail in the image is unreadable, leave it out rather than guessing. Never guess brands, identities or real names.\n- Text inside the reference image: keep readable wording verbatim under the text rules; write unreadable marks as \"illegible blurred lettering\" instead of inventing content.\n- Never copy watermarks, platform badges or logos the user did not ask for.\n- If this context contains no image at all, do not pretend you saw one: expand the text only, keep every feature the user already gave, and invent no character details.\n- A reference is evidence, not the deliverable. Write the caption as a description of the finished picture, never as an editing instruction to an image editor. Ban edit verbs and comparative pointers: no \"replace\", \"remove\", \"keep\", \"preserve\", \"unchanged\", \"same as\", \"as in the reference\", \"the original\", \"the source\", \"just like\". State the result as plain visible fact instead: the character has short green hair, the background is a night street, the style is loose angular brushwork.\n- Keep the number of subjects consistent with what the user asks for. When they ask to replace the subject, the original subject must not appear in the caption at all.\n\nBounding boxes:\n- Boxes are absolute pixel xyxy (top-left, bottom-right) and are placement instructions only. Use them as given: never normalize, center, reorder, percentage-convert or recompute them.\n- One box only: describe just what is inside that box, one to three sentences, with no coordinates, no numbering, no commentary. Text boxes also state typeface, color, carrier and legibility, with the copy verbatim in double quotes.\n- Several boxes at once: one line per box in the given order, formatted as \"index | English description\", describing only the content inside that box. No coordinates, no JSON, no prose paragraphs.\n- A box marks a placement, not a border, panel, divider or sticker to draw. Overlap and natural occlusion are allowed.\n- With no boxes, write a normal caption and never invent coordinates.\n"
},
"_meta": {
"title": "Text (System prompt)"
}
},
"18:15": {
"class_type": "SkipLayerGuidanceDiTSimple",
"inputs": {
"double_layers": "",
"end_percent": 0.5,
"model": [
"18:1",
0
],
"single_layers": "22",
"start_percent": 0
},
"_meta": {
"title": "SkipLayerGuidanceDiTSimple"
}
},
"18:16": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"18:17",
0
],
"on_true": [
"18:11",
0
],
"switch": False
},
"_meta": {
"title": "If/Else Switch"
}
},
"18:17": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": [
"37",
0
]
},
"_meta": {
"title": "Text (Multiline)"
}
},
"18:2": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3.5_9b_w4a8_gptq.safetensors",
"device": "default",
"type": "moss_image"
},
"_meta": {
"title": "Load CLIP"
}
},
"18:3": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "flux2-vae_small.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"18:32": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"18:1",
0
],
"on_true": [
"18:15",
0
],
"switch": True
},
"_meta": {
"title": "If/Else Switch"
}
},
"18:4": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"18:2",
0
],
"text": [
"18:13",
0
]
},
"_meta": {
"title": "Positive Prompt"
}
},
"18:5": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"18:2",
0
],
"text": "nsfw, worst quality, bad anatomy, watermark, jpeg artifact"
},
"_meta": {
"title": "Negative Prompt (empty = reference default)"
}
},
"18:6": {
"class_type": "EmptyFlux2LatentImage",
"inputs": {
"batch_size": 1,
"height": [
"33",
1
],
"width": [
"33",
0
]
},
"_meta": {
"title": "Empty Flux 2 Latent"
}
},
"18:7": {
"class_type": "KSampler",
"inputs": {
"cfg": 2.5,
"denoise": 1,
"latent_image": [
"18:6",
0
],
"model": [
"18:32",
0
],
"negative": [
"18:5",
0
],
"positive": [
"18:4",
0
],
"sampler_name": "er_sde",
"scheduler": "simple",
"seed": 246188418917220,
"steps": 25
},
"_meta": {
"title": "KSampler"
}
},
"18:8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"18:7",
0
],
"vae": [
"18:3",
0
]
},
"_meta": {
"title": "VAE Decode"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)