<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: kai liu</title>
    <description>The latest articles on DEV Community by kai liu (@kai_liu_9dbaeadb110db2d41).</description>
    <link>https://dev.to/kai_liu_9dbaeadb110db2d41</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4200086%2F02baccfb-e62e-4619-8b44-aebbe097c8c3.png</url>
      <title>DEV Community: kai liu</title>
      <link>https://dev.to/kai_liu_9dbaeadb110db2d41</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kai_liu_9dbaeadb110db2d41"/>
    <language>en</language>
    <item>
      <title>Generate images by describing object positions in JSON — MOSS-Image walkthrough</title>
      <dc:creator>kai liu</dc:creator>
      <pubDate>Thu, 22 Oct 2026 09:11:49 +0000</pubDate>
      <link>https://dev.to/kai_liu_9dbaeadb110db2d41/generate-images-by-describing-object-positions-in-json-moss-image-walkthrough-1nk0</link>
      <guid>https://dev.to/kai_liu_9dbaeadb110db2d41/generate-images-by-describing-object-positions-in-json-moss-image-walkthrough-1nk0</guid>
      <description>&lt;p&gt;Most image generation models understand prompts like "a red ball on the left and a blue cube on the right." The problem is, they understand it maybe half the time. The ball ends up on the right, or both objects merge into one, or the cube turns red too.&lt;/p&gt;

&lt;p&gt;Last week OpenMOSS released MOSS-Image, a 5B diffusion model under Apache 2.0 that addresses this with a different approach: describe object positions in JSON, and the model respects the coordinates.&lt;/p&gt;

&lt;p&gt;I put together a ComfyUI workflow and a prompt collection. Here's a walkthrough of how the JSON layout system works.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's different about MOSS-Image
&lt;/h2&gt;

&lt;p&gt;Two features most open-source image models struggle with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JSON layout control — specify where objects go with coordinates instead of prompt engineering&lt;/li&gt;
&lt;li&gt;Chinese and English text rendering — readable text in both languages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The text rendering is solid, but the layout system is what changes how you work.&lt;/p&gt;

&lt;h2&gt;
  
  
  JSON layout, explained
&lt;/h2&gt;

&lt;p&gt;Instead of a prompt like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"a cup of coffee on the left side of a wooden table and an open book on the right side, warm lighting"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You describe the scene in JSON:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"canvas"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"width"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"height"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"objects"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"a cup of coffee on a wooden table"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"position"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.35&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"detail"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ceramic white mug, steam rising"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"an open book"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"position"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.55&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.45&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.35&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"detail"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"old leather-bound book, yellowed pages"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"style"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"warm morning light, shallow depth of field"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each object gets a position (x and y, normalized to 0–1 where top-left is 0,0), a size, and an optional detail field. The model uses these coordinates to place objects before generating the image.&lt;/p&gt;

&lt;h2&gt;
  
  
  Accuracy
&lt;/h2&gt;

&lt;p&gt;From my testing with MOSS-Image-SFT:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JSON layout: roughly 80% of generations place objects correctly&lt;/li&gt;
&lt;li&gt;Natural language alone: roughly 40%&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The gap widens with more objects. Three objects with natural language is a dice roll. Three objects with JSON stays consistent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running it in ComfyUI
&lt;/h2&gt;

&lt;p&gt;MOSS-Image integrates natively into ComfyUI. Install the custom node through ComfyUI Manager (search "MOSS-Image"), download the model from HuggingFace, and you're good.&lt;/p&gt;

&lt;p&gt;I made a drag-and-drop workflow JSON that includes text-to-image, JSON layout control, prompt enhancer, and resolution presets from 512×512 to 1024×1024:&lt;/p&gt;

&lt;p&gt;→ &lt;a href="https://github.com/kaixin20190930/mossimage-workflow" rel="noopener noreferrer"&gt;mossimage-workflow on GitHub&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it online
&lt;/h2&gt;

&lt;p&gt;No ComfyUI? Generate directly at &lt;a href="https://mossimage.run" rel="noopener noreferrer"&gt;mossimage.run&lt;/a&gt; — free, 3 images per day, no sign-up.&lt;/p&gt;

&lt;p&gt;I also put together a prompt collection with verified examples for JSON layout, text rendering, and general generation:&lt;/p&gt;

&lt;p&gt;→ &lt;a href="https://github.com/kaixin20190930/mossimage-prompts" rel="noopener noreferrer"&gt;mossimage-prompts on GitHub&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;p&gt;Use SFT for layout, not Base. JSON layout accuracy drops noticeably with the Base model. SFT is the one you want for precise placement.&lt;/p&gt;

&lt;p&gt;Shorter prompts work better. MOSS-Image has a built-in prompt enhancer. A 15-word prompt often beats a 60-word one because the enhancer adds detail without conflicting with your instructions.&lt;/p&gt;

&lt;p&gt;Tell it what kind of text to render. Say "a neon sign" or "a poster" instead of just "an image with text." The context helps the model choose the right rendering style.&lt;/p&gt;

&lt;p&gt;Fixed seed for reproducibility. Same as any diffusion model. Start with square aspect ratio and change one variable at a time.&lt;/p&gt;




&lt;p&gt;The JSON layout is the part worth paying attention to. Being able to specify "put this here and that there" and have it actually work is something open-source image models haven't done well before.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>comfyui</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
