How Image Generation Models Can Render Chinese Text and Support Arbitrary Resolutions

    This article explains why readable text rendering is difficult for image generation models, why Chinese characters present additional challenges, and how a hybrid architecture can combine semantic understanding, glyph encoding, and diffusion decoding. It also outlines synthetic data generation and the need to evaluate text rendering accuracy as an independent metric.

    1. Why Text Rendering Is Difficult

    Image generation models are highly capable at composition, lighting, and object structure. However, their weaknesses become obvious when they need to generate readable text inside an image. Common errors include missing or distorted strokes, merged adjacent strokes, confusing similar-looking characters, or producing text that has the appearance of writing but cannot actually be read. People are highly sensitive to textual errors: a single incorrect character can make a poster unusable.

    Chinese is more challenging than Latin-based writing systems. Latin alphabets contain only a few dozen basic symbols, while commonly used Chinese includes thousands of characters. Each character is also composed of multiple strokes arranged according to a fixed structure. Training data rarely provides sufficient examples for every character. Rare characters and complex character combinations are particularly underrepresented.

    In practical applications, text rendering is mainly required in three types of scenarios:

    • Commercial posters: Headlines, promotional copy, and prices must be accurate.
    • Social media covers: Titles need to be legible and visually consistent with the layout.
    • Educational illustrations: Captions, labels, and explanatory text must be readable.

    For this reason, text-rendering accuracy should be evaluated as an independent metric rather than relying only on overall image quality.

    2. A Hybrid Architecture for Understanding and Rendering

    A common approach is to divide the generation process into two modules: one for understanding and one for rendering.

    The understanding module typically uses an autoregressive language model architecture. It receives the user prompt and analyzes the subject, style, layout, text to be rendered, and spatial relationships between elements. It then produces a set of intermediate representations that can be viewed as a composition plan for the entire image.

    The rendering module is usually a diffusion decoder. Conditioned on the intermediate representations, it gradually reconstructs pixels from noise and is responsible for textures, lighting, and visual details.

    This separation offers three main advantages:

    1. Semantic understanding and visual-detail generation have different optimization objectives, so training can be more stable when they are separated.
    2. The understanding module can reuse a language model’s capabilities in reasoning and instruction following.
    3. Text content is explicitly extracted during the understanding stage, making it easier to validate later.

    A simplified inference process is shown below:

    1. def generate_image(prompt, width, height):
    2. # 1. Semantic understanding: parse the subject, layout, and text to render
    3. plan = understanding_module(prompt)
    4. # 2. Extract text to render and generate glyph conditions
    5. texts = extract_render_texts(plan)
    6. glyph_cond = glyph_encoder(texts, plan.text_regions)
    7. # 3. Diffusion decoding: use semantic and glyph conditions during denoising
    8. latent = diffusion_decoder.sample(
    9. condition=plan.embedding,
    10. glyph=glyph_cond,
    11. size=(width, height),
    12. )
    13. return vae_decode(latent)

    The key point is the flow of conditioning signals. Semantic conditions determine the content of the image, while glyph conditions determine the structure of the text. Both take effect during the decoding stage.

    3. Introducing Explicit Glyph Information

    When a model relies only on textual semantics, it is difficult for it to accurately reproduce the stroke structure of every character. One solution is to represent “what the text says” and “what the characters look like” separately. Text semantics provide the content, while glyph encoding provides structural information.

    A basic glyph-encoding process includes the following steps:

    • For each character to be rendered, obtain a standardized glyph representation, such as a rasterized font image or an encoding of font-outline features.
    • Align the glyph features with the corresponding image regions according to each character’s position in the composition.
    • Provide the aligned features as additional conditions to the diffusion decoder.

    Training data is critical to this approach. Large numbers of text-containing images can be generated programmatically by randomly selecting fonts, font sizes, colors, backgrounds, and layouts. The text is rendered while its content and positional annotations are recorded at the same time. Synthetic data can cover common characters, rare characters, and a wide range of layouts, helping compensate for uneven distributions in real-world data.

    For evaluation, text-rendering accuracy should be measured independently alongside overall image quality, so that character-level errors are not hidden by a visually convincing composition.