Text to Image for Openclaw

A versatile rendering engine that transforms text snippets into high-quality image files with granular control over typography, colors, and layout.

erickong
v0.1.0
Mar 11, 2026
0
1.3k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install text-to-image

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install text-to-image using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Text to Image?

The Text to Image skill is a professional-grade utility designed for Openclaw Skills to programmatically generate visual assets from text. It bridges the gap between raw data and visual presentation by allowing AI agents to render slogans, posters, and multilingual snippets into various formats like PNG, SVG, and JPEG. The skill handles complex layout tasks such as newline-aware wrapping, automatic font-size fitting, and partial text highlighting with ease.

Built to be cross-platform, this tool ensures consistent output on both Windows and macOS by utilizing robust font fallback mechanisms. Whether you need a transparent background for a UI element or a solid-colored poster for social media, this skill provides the precision required for developer-centric image generation tasks.

Text to Image Use Cases

  • Creating dynamic social media banners and marketing slogans with specific brand colors.
  • Generating localized image assets for multilingual applications using system font fallbacks.
  • Highlighting specific keywords within a block of text for educational or presentational images.
  • Producing automated captions and snippets for video production or web design workflows.
  • Programmatically generating text-based posters with precise layout and padding requirements.

How Text to Image Works

  1. The skill accepts a JSON specification defining the text content, dimensions, and styling rules.
  2. It analyzes the input to determine if specific ranges or text segments require unique coloring or font weights.
  3. A layout engine calculates text wrapping and scales the font size to fit the specified dimensions if an explicit size is not provided.
  4. The script renders the text into the chosen format (SVG, PNG, or JPG) using platform-native font libraries.
  5. The final image is saved to a local temporary directory, and the skill returns a JSON response containing the absolute file path, metadata, and optional data URI.

Text to Image Setup

To integrate this capability into your Openclaw Skills environment, ensure you have a Python environment ready. You can trigger the rendering engine using the following command structure:

# Generate an image using a JSON specification file
python scripts/render_text_image.py --spec-file path/to/spec.json --no-data-url

# Or pass the specification directly via CLI
python scripts/render_text_image.py --spec-json '{"text": "Hello World", "format": "png"}'

Text to Image Data Schema & Taxonomy

The skill relies on a structured input schema to define the visual output. Below are the primary configuration fields:

Field Description
text The primary string to be rendered.
highlight_texts An array of objects to colorize specific word matches.
segments A precise array of text pieces with individual color assignments.
width / height The target dimensions in pixels for the output file.
format The output file type: svg (default), png, jpg, or jpeg.
font_size Optional pixel size; if omitted, the script auto-fits the text.

The output contains the file_path, file_size, and mime_type to allow seamless file handling within the Openclaw Skills ecosystem.

Text to Image Advanced Features

  • Intelligent auto-fit logic that searches for the optimal font size to fill the image boundaries.
  • Partial text styling via highlight_ranges, allowing for character-level color control.
  • Comprehensive font fallback support for Microsoft YaHei, PingFang SC, and other system fonts to ensure multilingual compatibility.
  • Support for transparent backgrounds in PNG and SVG formats for easy overlaying in design work.
  • Flexible output options including relative paths, absolute paths, and Base64 data URIs for different implementation needs.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*