Image studio

From InugamiDev/ultrathink-oss · View interactive version

Image studio is an AI agent skill from the GitHub repository InugamiDev/ultrathink-oss. Unified image generation pipeline — visual rendering (logos, icons, diagrams, flowcharts, architecture) from HTML/SVG/Canvas, structured illustration prompts with multi-backend routing, autonomous image generation via TinyFish/Gemini/Playwright, banner design for social/ads/heroes/print. Single entr

How to use this skill

Skill file

image-studio

Unified image generation pipeline — visual rendering (logos, icons, diagrams, flowcharts, architecture) from HTML/SVG/Canvas, structured illustration prompts with multi-backend routing, autonomous image generation via TinyFish/Gemini/Playwright, banner design for social/ads/heroes/print. Single entry point for any image/graphic asset task.

Absorbs


From `visual-render`

Generate visual images from HTML/SVG/Canvas — logos, icons, diagrams, charts, infographics, tables, flowcharts, architecture maps, ER diagrams. Pipeline: Claude generates HTML → Playwright screenshots → Python crop/trim/export → clean PNG/SVG/WebP output file. Actions: render, generate, create, design, export, capture. Types: logo, icon, diagram, flowchart, chart, table, infographic, architecture, ER diagram, sequence diagram, network graph, timeline, badge, banner.

Visual Render Skill

Generate images from HTML/SVG/Canvas using a Playwright capture pipeline with Python post-processing.

Visual Types

| Type | Best Renderer | Notes |

|------|--------------|-------|

| Logo | SVG inline | Vector, scalable, transparent bg |

| Icon | SVG inline | 24×24 to 512×512, viewBox required |

| Diagram / Flowchart | HTML+CSS or SVG | Use CSS Grid for layout |

| Architecture diagram | HTML+CSS boxes+arrows | Flexbox/Grid containers |

| ER diagram | SVG | Tables as rects, relationships as lines |

| Sequence diagram | HTML table or SVG | Time flows top→bottom |

| Chart (bar/line/pie) | Chart.js via CDN | Canvas element, wait 500ms |

| Data table | HTML <table> | Styled with CSS |

| Infographic | HTML sections | Mix of SVG + text |

| Badge / Label | SVG or HTML | Small, sharp output |

| Network graph | SVG with paths | Nodes as circles, edges as lines |

| Timeline | HTML+CSS | Horizontal or vertical |


Workflow

Step 1: Generate the HTML file

Write a self-contained HTML file to /tmp/visual-render/<name>.html.

Required wrapper — the capture script targets [data-export]:

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <style>
    * { margin: 0; padding: 0; box-sizing: border-box; }
    body { background: transparent; font-family: system-ui, sans-serif; }
  </style>
</head>
<body>
  <div data-export style="display: inline-block; padding: 24px;">
    <!-- YOUR VISUAL HERE -->
  </div>
</body>
</html>

Step 2: Run the capture script

~/.local/share/ultrathink/venv/bin/python3 \
  ~/.claude/skills/visual-render/scripts/capture.py \
  /tmp/visual-render/<name>.html \
  /tmp/visual-render/<name>.png

Full options:

--scale 2          HiDPI output (default: 2 for retina-quality)
--bg white         Background: transparent (default), white, black, #hex
--padding 32       Extra padding around content (default: 24)
--format png       Output format: png, jpeg, webp (default: png)
--selector .card   Override CSS selector (default: [data-export])
--wait 600         Wait ms after load, useful for Chart.js animations (default: 300)
--width 1400       Viewport width (default: 1200)
--no-trim          Skip whitespace trim

Step 3: Show the result

After capture, show the image path and optionally display it.


HTML Patterns by Type

Logo (SVG)

<div data-export style="display:inline-flex; padding:32px;">
  <svg width="200" height="80" viewBox="0 0 200 80" xmlns="http://www.w3.org/2000/svg">
    <!-- logomark -->
    <rect x="0" y="20" width="40" height="40" rx="8" fill="#6366f1"/>
    <text x="50" y="52" font-family="system-ui" font-weight="700" font-size="28" fill="#1e1e2e">BrandName</text>
  </svg>
</div>

Icon (SVG)

<div data-export style="display:inline-flex; padding:16px; background:#f8f9fa; border-radius:12px;">
  <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="#6366f1" stroke-width="2" xmlns="http://www.w3.org/2000/svg">
    <path stroke-linecap="round" stroke-linejoin="round" d="M12 2L2 7l10 5 10-5-10-5z"/>
    <path stroke-linecap="round" stroke-linejoin="round" d="M2 17l10 5 10-5M2 12l10 5 10-5"/>
  </svg>
</div>

Flowchart (HTML+CSS)

<div data-export style="padding:40px; font-family:system-ui; background:#fff; border-radius:16px;">
  <style>
    .flow { display:flex; flex-direction:column; align-items:center; gap:0; }
    .node { padding:12px 24px; border-radius:8px; font-size:14px; font-weight:500; text-align:center; min-width:160px; }
    .start { background:#6366f1; color:#fff; border-radius:24px; }
    .process { background:#f1f5f9; border:2px solid #e2e8f0; color:#1e293b; }
    .decision { background:#fef3c7; border:2px solid #f59e0b; color:#92400e; transform:rotate(0); clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%); padding:20px 32px; }
    .end { background:#22c55e; color:#fff; border-radius:24px; }
    .arrow { width:2px; height:28px; background:#cbd5e1; margin:0 auto; position:relative; }
    .arrow::after { content:''; position:absolute; bottom:0; left:50%; transform:translateX(-50%); border:6px solid transparent; border-top:8px solid #cbd5e1; }
  </style>
  <div class="flow">
    <div class="node start">Start</div>
    <div class="arrow"></div>
    <div class="node process">Process Step</div>
    <div class="arrow"></div>
    <div class="node decision">Decision?</div>
    <div class="arrow"></div>
    <div class="node end">End</div>
  </div>
</div>

Chart (Chart.js)

<div data-export style="padding:32px; background:#fff; border-radius:16px; width:600px;">
  <canvas id="chart" width="540" height="320"></canvas>
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  <script>
    new Chart(document.getElementById('chart'), {
      type: 'bar',
      data: {
        labels: ['Jan','Feb','Mar','Apr','May'],
        datasets:[{ label:'Revenue', data:[12,19,8,15,23], backgroundColor:'#6366f1' }]
      },
      options: { responsive:false, plugins:{ legend:{ display:true } } }
    });
  </script>
</div>

Use --wait 600 for Chart.js to finish rendering.

Data Table

<div data-export style="padding:24px; background:#fff; border-radius:12px; font-family:system-ui;">
  <table style="border-collapse:collapse; min-width:400px; font-size:14px;">
    <thead>
      <tr style="background:#6366f1; color:#fff;">
        <th style="padding:12px 16px; text-align:left;">Name</th>
        <th style="padding:12px 16px; text-align:right;">Value</th>
      </tr>
    </thead>
    <tbody>
      <tr style="border-bottom:1px solid #f1f5f9;">
        <td style="padding:10px 16px;">Row 1</td>
        <td style="padding:10px 16px; text-align:right;">100</td>
      </tr>
    </tbody>
  </table>
</div>

Architecture Diagram

<div data-export style="padding:40px; background:#0f172a; border-radius:16px; font-family:system-ui; color:#e2e8f0; min-width:700px;">
  <style>
    .arch { display:flex; gap:32px; align-items:center; }
    .box { padding:16px 20px; border-radius:10px; border:2px solid; font-size:13px; font-weight:500; text-align:center; min-width:100px; }
    .client { background:#1e3a5f; border-color:#3b82f6; color:#93c5fd; }
    .service { background:#1a2e1a; border-color:#22c55e; color:#86efac; }
    .db { background:#2d1b1b; border-color:#ef4444; color:#fca5a5; }
    .arrow { font-size:20px; color:#64748b; }
  </style>
  <div class="arch">
    <div class="box client">Browser</div>
    <span class="arrow">→</span>
    <div class="box service">API Server</div>
    <span class="arrow">→</span>
    <div class="box db">Database</div>
  </div>
</div>

Post-Processing Options

| Goal | Command flag |

|------|-------------|

| Crisp retina output | --scale 2 (default) |

| White background | --bg white |

| Transparent background | --bg transparent (default) |

| Fixed size output | --resize 512x512 |

| JPEG for photos | --format jpeg --quality 90 |

| WebP for web | --format webp --quality 85 |

| No auto-crop | --no-trim |

| Extra padding | --padding 48 |


Setup (first time only)

python3 -m venv ~/.local/share/ultrathink/venv
~/.local/share/ultrathink/venv/bin/pip install playwright Pillow
~/.local/share/ultrathink/venv/bin/playwright install chromium

Already done on this machine — venv is at ~/.local/share/ultrathink/venv.


Anti-Patterns


From `illustration-generator`

Auto-triggered illustration generator. Builds structured JSON prompts from user intent, then generates images via Gemini browser automation (Nano Banana 2).

Illustration Generator

Auto-triggered skill that converts user intent into structured prompts and generates

images via Gemini browser automation (Nano Banana 2 model).

How This Skill Works

When triggered, follow this exact pipeline:

Phase 1: ANALYZE — Understand the request

Extract from the user's message:

If the user's intent is vague, pick sensible defaults based on the use case.

Phase 2: PROMPT — Build the generation manifest

Create a JSON manifest with structured prompts. Each prompt MUST follow this formula:

Generate an image: [STYLE] illustration of [SUBJECT], [COMPOSITION],
using [N] colors: [HEX1], [HEX2], [HEX3].
[TECHNIQUE] style, [DIMENSIONS].
NO TEXT, NO WORDS, NO LETTERS.

Manifest format:

{
  "name": "Project Asset Batch",
  "model": "gemini-3.1-flash-image-preview",
  "outputDir": "public/illustrations",
  "assets": [
    {
      "name": "hero",
      "prompt": "Generate an image: Minimal isometric illustration of a workflow engine with connected nodes and data streams, centered composition, using 3 colors: deep navy (#0f172a), amber (#f59e0b), white (#ffffff). Clean vector style, 1024x1024. NO TEXT, NO WORDS, NO LETTERS.",
      "use": "Landing page hero"
    },
    {
      "name": "empty-state",
      "prompt": "Generate an image: Simple line drawing of an empty inbox with a small sparkle, centered, using 2 colors: slate (#94a3b8), white (#ffffff). Thin line art style, 512x512. NO TEXT, NO WORDS, NO LETTERS.",
      "use": "Dashboard empty state"
    }
  ]
}

Phase 3: GENERATE — Execute via Gemini browser automation

Backend priority order:

  1. Gemini Browser Automation (primary) — Uses saved Google session via Playwright
  2. Gemini API (fallback 1) — Requires GEMINI_API_KEY in .env
  3. Puter.js (fallback 2) — Free, no auth, rate-limited
Primary: Gemini Browser Automation

Use Playwright-based Gemini browser automation to generate each asset from the manifest.

Important execution rules:

Fallback 1: Gemini API

If no browser session exists and GEMINI_API_KEY is set:

import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

const response = await ai.models.generateContent({
  model: "gemini-3.1-flash-image-preview",
  contents: "<prompt from manifest>",
  config: { responseModalities: ["TEXT", "IMAGE"] },
});
Fallback 2: Puter.js (free, no auth)

If neither browser session nor API key is available:

const response = await fetch("https://api.puter.com/ai/txt2img", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    prompt: "<prompt from manifest>",
    model: "gemini-3.1-flash-image-preview",
  }),
});
const buffer = Buffer.from(await response.arrayBuffer());

Phase 4: DELIVER — Present results

After generation:

  1. Show each generated image to the user
  2. List file paths and sizes
  3. Ask if they want variations, adjustments, or are happy with the results
  4. If the user wants changes, go back to Phase 2 with refined prompts

Prompt Rules (Critical)

  1. Always prefix with "Generate an image:" — this triggers Gemini's image mode
  2. Always end with "NO TEXT, NO WORDS, NO LETTERS" in ALL CAPS — models ignore lowercase
  3. Specify exact hex colors — never let the model guess colors
  4. State dimensions explicitly — 1024x1024 (square), 1920x1080 (hero), 512x512 (icon)
  5. Describe composition — centered, asymmetric, full-bleed, contained
  6. Specify style precisely — isometric, flat, line art, 3D, watercolor, geometric
  7. One subject per prompt — don't combine unrelated elements

Dimension Guide

| Use Case | Dimensions | Aspect Ratio |

|----------|-----------|--------------|

| Logo / Icon | 512x512 | 1:1 |

| Square illustration | 1024x1024 | 1:1 |

| Hero banner | 1920x1080 | 16:9 |

| Wide banner | 1920x400 | ~5:1 |

| Feature card | 800x600 | 4:3 |

| Social media | 1200x630 | ~2:1 |

| Mobile splash | 1080x1920 | 9:16 |

Style Presets

When the user doesn't specify a style, pick based on context:

| Context | Recommended Style |

|---------|------------------|

| Developer tool / SaaS | Isometric, clean vector, navy/amber palette |

| Documentation | Line art, minimal, single accent color |

| Landing page hero | Flat illustration, bold colors, centered subject |

| Empty state | Thin line drawing, muted colors, simple composition |

| Error page | Playful isometric, warm colors, humorous subject |

| Blog / content | Watercolor or editorial style, rich colors |

| Logo | Geometric, strong silhouette, 2-3 colors max |

Setup: Gemini Browser Automation

Quick setup

npx playwright install chromium

Auth via cookie import (recommended)

  1. Install a cookie export extension:
  1. Go to gemini.google.com (must be logged in)
  2. Click the extension icon → Export cookies → saves cookies.txt
  3. Import:

```bash

npm run gemini:auth -- --cookies path/to/cookies.txt

```

Auth via interactive login (alternative)

npm run gemini:auth

Opens a browser → log in to Google → press Enter to save session.

Session expired?

npm run gemini:auth -- --cookies cookies.txt --force

Image Quality

Example Trigger Flows

User says: "generate a logo for ultrathink"

→ Phase 1: Subject=brain+circuits, Use=logo, Style=geometric, Colors=navy+amber

→ Phase 2: Creates manifest with 2-3 logo variations (different compositions)

→ Phase 3: Runs gemini:generate for each

→ Phase 4: Shows results, asks for preference

User says: "I need hero images for the landing page"

→ Phase 1: Subject=from project context, Use=hero, Style=isometric, Dimensions=1920x1080

→ Phase 2: Creates manifest with hero + supporting illustrations

→ Phase 3: Generates sequentially

→ Phase 4: Presents full set

User says: "make empty state illustrations for the dashboard"

→ Phase 1: Subject=empty inbox/chart/list, Use=empty-state, Style=line-art, Dimensions=512x512

→ Phase 2: Creates 3-4 context-appropriate empty states

→ Phase 3: Generates each

→ Phase 4: Shows results


From `image-pipeline`

Autonomous image generation pipeline — TinyFish, Gemini-API, Playwright backends

Image Pipeline — Autonomous Asset Generation

Generate illustrations and assets through Google Gemini via three configurable backends:

TinyFish (primary) → Gemini-API (Option C) → Playwright (fallback).

Architecture

Claude Code (user describes assets)
       ↓
JSON Manifest: [{id, prompt, style, dimensions}, ...]
       ↓
Backend Selection (configurable in dashboard)
       ↓
┌─────────────┬──────────────────┬────────────────────┐
│  TinyFish   │   Gemini-API     │    Playwright       │
│  (primary)  │   (Option C)     │    (fallback)       │
│             │                  │                     │
│ Cloud agent │ Python webapi    │ Local browser       │
│ SSE stream  │ Cookie auth      │ Chromium automation │
│ $0.015/step │ Free (fragile)   │ Free (local)        │
└─────────────┴──────────────────┴────────────────────┘
       ↓
Generated assets → /tmp/ultrathink-assets/output/

Pipeline Flow

1. Create Manifest (CLI or Dashboard)

Via Claude Code — describe assets naturally:

"Create a manifest called 'App Icons' with:
- A futuristic brain icon with circuit patterns
- An abstract wave pattern in amber and black
- A minimalist rocket ship logo"

The skill converts this to a JSON manifest and calls the API.

Via Dashboard — navigate to /assets, click "New Manifest":

2. Configure Backend (Dashboard → /assets → Configure)

TinyFish (recommended for reliability):

Gemini-API (free, Python-based):

Playwright (local fallback):

3. Generate

Via Dashboard: Click play button on manifest → pipeline processes each asset sequentially.

Via API:

# Create manifest
curl -X POST http://localhost:3333/api/assets \
  -H "Content-Type: application/json" \
  -d '{
    "action": "create-manifest",
    "name": "My Assets",
    "backend": "tinyfish",
    "assets": [
      {"prompt": "A cyberpunk cityscape", "style": "illustration", "dimensions": "1024x1024"},
      {"prompt": "Abstract geometric logo", "style": "minimalist"}
    ]
  }'

# Start generation
curl -X POST http://localhost:3333/api/assets/generate \
  -H "Content-Type: application/json" \
  -d '{"manifestId": "ast_xxx"}'

# Check status
curl http://localhost:3333/api/assets?id=ast_xxx

4. Monitor

Dashboard auto-polls every 3s during generation. Each asset shows:

Backend Details

TinyFish API

POST https://agent.tinyfish.ai/v1/automation/run-sse
Headers: X-API-Key: $TINYFISH_API_KEY
Body: { url, goal, browser_profile }
Response: SSE stream → { type: "COMPLETE", result: {...} }

Pricing: 500 free steps, then $0.015/step or $15/mo starter plan.

Gemini-API (Python)

from gemini_webapi import GeminiClient

client = GeminiClient(secure_1psid, secure_1psidts)
await client.init(timeout=60)
response = await client.generate_content("Generate an image: ...")
# response.images[0].url or response.images[0].data (base64)

Requires Python 3.10+. Cookies auto-refresh. Model selection via model param.

Playwright

Automates Chromium browser to interact with gemini.google.com directly.

Finds prompt input, types, waits for generation, extracts image from DOM.

Most resilient to API changes but slowest.

Manifest JSON Schema

interface AssetManifest {
  id: string;           // auto-generated: ast_<ts>_<rand>
  name: string;         // human-readable name
  description?: string;
  backend: "tinyfish" | "gemini-api" | "playwright";
  assets: AssetEntry[];
  createdAt: string;    // ISO timestamp
  updatedAt: string;
}

interface AssetEntry {
  id: string;
  prompt: string;           // image description
  negativePrompt?: string;  // what to avoid
  style?: string;           // illustration, minimalist, etc.
  dimensions?: string;      // 1024x1024
  status: "pending" | "generating" | "completed" | "failed";
  outputPath?: string;      // file path when completed
  error?: string;           // error message when failed
  retries: number;
  generatedAt?: string;
}

Storage

Dashboard

Page: http://localhost:3333/assets

Error Handling


From `ckm:banner-design`

Design banners for social media, ads, website heroes, creative assets, and print. Multiple art direction options with AI-generated visuals. Actions: design, create, generate banner. Platforms: Facebook, Twitter/X, LinkedIn, YouTube, Instagram, Google Display, website hero, print. Styles: minimalist, gradient, bold typography, photo-based, illustrated, geometric, retro, glassmorphism, 3D, neon, duotone, editorial, collage. Uses ui-ux-pro-max, frontend-design, ai-artist, ai-multimodal skills.

Banner Design - Multi-Format Creative Banner System

Design banners across social, ads, web, and print formats. Generates multiple art direction options per request with AI-powered visual elements. This skill handles banner design only. Does NOT handle video editing, full website design, or print production.

When to Activate

Workflow

Step 1: Gather Requirements (AskUserQuestion)

Collect via AskUserQuestion:

  1. Purpose — social cover, ad banner, website hero, print, or creative asset?
  2. Platform/size — which platform or custom dimensions?
  3. Content — headline, subtext, CTA, logo placement?
  4. Brand — existing brand guidelines? (check docs/brand-guidelines.md)
  5. Style preference — any art direction? (show style options if unsure)
  6. Quantity — how many options to generate? (default: 3)

Step 2: Research & Art Direction

  1. Activate ui-ux-pro-max skill for design intelligence
  2. Use Chrome browser to research Pinterest for design references:

```

Navigate to pinterest.com → search "[purpose] banner design [style]"

Screenshot 3-5 reference pins for art direction inspiration

```

  1. Select 2-3 complementary art direction styles from references:

references/banner-sizes-and-styles.md

Step 3: Design & Generate Options

For each art direction option:

  1. Create HTML/CSS banner using frontend-design skill
  1. Generate visual elements using AI image generation skills

Use the ai-artist skill for prompt inspiration (6000+ examples in its references)

and the ai-multimodal skill for image generation via Gemini API.

When to use which model:

| Use Case | Model | Quality |

|----------|-------|---------|

| Backgrounds, gradients, patterns | Standard (Flash) | 2K, fast |

| Hero illustrations, product shots | Pro | 4K, detailed |

| Photorealistic scenes, complex art | Pro | 4K, best quality |

| Quick iterations, A/B variants | Standard (Flash) | 2K, fast |

Aspect ratios: 1:1, 16:9, 9:16, 3:4, 4:3, 2:3, 3:2

Match to platform - e.g., Twitter header = 3:1 (use 3:2 closest), Instagram story = 9:16

Pro model prompt tips (see ai-artist references/nano-banana-pro-examples.md):

  1. Compose final banner — overlay text, CTA, logo on generated visual in HTML/CSS

Step 4: Export Banners to Images

After designing HTML banners, export each to PNG using the chrome-devtools skill:

  1. Serve HTML files via local server (python http.server or similar)
  2. Screenshot each banner at exact platform dimensions using the chrome-devtools skill's screenshot capability
  3. Auto-compress if >5MB using Sharp or similar

Output path convention (per assets-organizing skill):

assets/banners/{campaign}/
├── minimalist-1500x500.png
├── gradient-1500x500.png
├── bold-type-1500x500.png
├── minimalist-1080x1080.png    # if multi-size requested
└── ...

Step 5: Present Options & Iterate

Present all exported images side-by-side. For each option show:

Iterate based on user feedback until approved.

Banner Size Quick Reference

| Platform | Type | Size (px) | Aspect Ratio |

|----------|------|-----------|--------------|

| Facebook | Cover | 820 × 312 | ~2.6:1 |

| Twitter/X | Header | 1500 × 500 | 3:1 |

| LinkedIn | Personal | 1584 × 396 | 4:1 |

| YouTube | Channel art | 2560 × 1440 | 16:9 |

| Instagram | Story | 1080 × 1920 | 9:16 |

| Instagram | Post | 1080 × 1080 | 1:1 |

| Google Ads | Med Rectangle | 300 × 250 | 6:5 |

| Google Ads | Leaderboard | 728 × 90 | 8:1 |

| Website | Hero | 1920 × 600-1080 | ~3:1 |

Full reference: references/banner-sizes-and-styles.md

Art Direction Styles (Top 10)

| Style | Best For | Key Elements |

|-------|----------|--------------|

| Minimalist | SaaS, tech | White space, 1-2 colors, clean type |

| Bold Typography | Announcements | Oversized type as hero element |

| Gradient | Modern brands | Mesh gradients, chromatic blends |

| Photo-Based | Lifestyle, e-com | Full-bleed photo + text overlay |

| Geometric | Tech, fintech | Shapes, grids, abstract patterns |

| Retro/Vintage | F&B, craft | Distressed textures, muted colors |

| Glassmorphism | SaaS, apps | Frosted glass, blur, glow borders |

| Neon/Cyberpunk | Gaming, events | Dark bg, glowing neon accents |

| Editorial | Media, luxury | Grid layouts, pull quotes |

| 3D/Sculptural | Product, tech | Rendered objects, depth, shadows |

Full 22 styles: references/banner-sizes-and-styles.md

Design Rules

Security

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.