seo-image-gen
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSEO Image Gen: AI Image Generation for SEO Assets (Extension)
SEO图像生成:面向SEO资产的AI图像生成工具(扩展)
Generate production-ready images for SEO use cases using Gemini's image generation
via the banana Creative Director pipeline. Maps SEO needs to optimized domain modes,
aspect ratios, and resolution defaults.
借助Gemini的图像生成能力,通过banana创意总监工作流生成可直接用于生产环境的SEO场景图像。该工具可将SEO需求映射为优化后的领域模式、宽高比和默认分辨率。
Architecture Note
架构说明
This extension is built on Claude Banana,
the standalone AI image generation skill for Claude Code.
This skill has two components with distinct roles:
- SKILL.md (this file): Handles interactive commands for generating images
/seo image-gen - Agent (): Audit-only analyst spawned during
agents/seo-image-gen.mdto assess existing OG/social images and produce a generation plan (never auto-generates)/seo audit
本扩展基于Claude Banana构建,这是一款面向Claude Code的独立AI图像生成技能。
该技能包含两个功能不同的组件:
- SKILL.md(即本文档):处理交互式命令以生成图像
/seo image-gen - Agent():仅用于审计的分析模块,在执行
agents/seo-image-gen.md时启动,用于评估现有OG/社交图像并生成制作计划(绝不会自动生成图像)/seo audit
Prerequisites
前置条件
This skill requires the banana extension to be installed:
bash
./extensions/banana/install.shCheck availability: Before using any image generation tool, verify the MCP server
is connected by checking if or tools are
available. If tools are not available, inform the user the extension is not installed
and provide install instructions.
gemini_generate_imageset_aspect_ratio使用本技能需安装banana扩展:
bash
./extensions/banana/install.sh可用性检查:在使用任何图像生成工具前,需通过检查或工具是否可用,来验证MCP服务器是否已连接。若工具不可用,需告知用户扩展未安装并提供安装说明。
gemini_generate_imageset_aspect_ratioQuick Reference
快速参考
| Command | What it does |
|---|---|
| Generate OG/social preview image (1200x630 feel) |
| Blog hero image (widescreen, dramatic) |
| Product photography (clean, white BG) |
| Infographic visual (vertical, data-heavy) |
| Custom image with full Creative Director pipeline |
| Generate N variations (default: 3) |
| 命令 | 功能 |
|---|---|
| 生成OG/社交预览图(适配1200x630尺寸) |
| 生成博客首图(宽屏、富有视觉冲击力) |
| 生成产品摄影图(简洁、白色背景) |
| 生成信息图(竖版、数据密集型) |
| 通过完整创意总监工作流生成自定义图像 |
| 生成N张变体图(默认3张) |
SEO Image Use Cases
SEO图像使用场景
Each use case maps to pre-configured banana parameters:
| Use Case | Aspect Ratio | Resolution | Domain Mode | Notes |
|---|---|---|---|---|
| OG/Social Preview | | | Product or UI/Web | Clean, professional, text-friendly |
| Blog Hero | | | Cinema or Editorial | Dramatic, atmospheric, editorial quality |
| Schema Image | | | Product | Clean, descriptive, schema ImageObject |
| Social Square | | | UI/Web | Platform-optimized square |
| Product Photo | | | Product | White background, studio lighting |
| Infographic | | | Infographic | Data-heavy, vertical layout |
| Favicon/Icon | | | Logo | Minimal, scalable, recognizable |
| Pinterest Pin | | | Editorial | Tall vertical card |
每个场景都对应预配置的banana参数:
| 使用场景 | 宽高比 | 分辨率 | 领域模式 | 说明 |
|---|---|---|---|---|
| OG/社交预览图 | | | 产品或UI/网页 | 简洁专业、适配文本展示 |
| 博客首图 | | | 影视或编辑风格 | 视觉冲击力强、氛围感足、达到编辑级质量 |
| Schema图片 | | | 产品 | 简洁直观、符合Schema ImageObject规范 |
| 社交平台方形图 | | | UI/网页 | 适配平台的方形尺寸 |
| 产品摄影图 | | | 产品 | 白色背景、影棚级打光 |
| 信息图 | | | 信息图 | 数据密集、竖版布局 |
| 网站图标/Favicon | | | Logo | 极简风格、可缩放、辨识度高 |
| Pinterest帖子图 | | | 编辑风格 | 竖版长卡片布局 |
Generation Pipeline
生成流程
For every generation request:
- Identify use case from command or context (og, hero, product, etc.)
- Apply SEO defaults from the use cases table above
- Set aspect ratio via MCP tool
set_aspect_ratio - Construct Reasoning Brief using the banana Creative Director pipeline:
- Load for the 6-component system
references/prompt-engineering.md - Apply domain mode emphasis (Subject 30%, Style 25%, Context 15%, etc.)
- Be SPECIFIC and VISCERAL: describe what the camera sees
- Load
- Generate via MCP tool
gemini_generate_image - Post-generation SEO checklist (see below)
针对每一个生成请求:
- 识别使用场景:从命令或上下文判断(如og、hero、product等)
- 应用SEO默认配置:参考上述使用场景表格中的参数
- 设置宽高比:通过MCP工具完成
set_aspect_ratio - 构建推理提示词:使用banana创意总监工作流:
- 加载中的6组件系统
references/prompt-engineering.md - 侧重领域模式(主体30%、风格25%、上下文15%等)
- 描述需具体且有画面感:明确说明镜头所呈现的内容
- 加载
- 生成图像:通过MCP工具执行
gemini_generate_image - 生成后SEO检查清单(见下文)
Check for Presets
预设配置检查
If the user mentions a brand or has SEO presets configured:
bash
python3 ~/.claude/skills/seo-image-gen/scripts/presets.py listLoad matching preset and apply as defaults. Also check
for SEO-specific preset templates.
references/seo-image-presets.md若用户提及品牌或已配置SEO预设:
bash
python3 ~/.claude/skills/seo-image-gen/scripts/presets.py list加载匹配的预设并设为默认值。同时可查看获取SEO专属预设模板。
references/seo-image-presets.mdPost-Generation SEO Checklist
生成后SEO检查清单
After every successful generation, guide the user on:
- Alt text:Write descriptive, keyword-rich alt text for the generated image
- File naming:Rename to SEO-friendly format:
keyword-description-widthxheight.webp - WebP conversion:Convert to WebP for optimal page speed:
bash
magick output.png -quality 85 output.webp - File size:Target under 200KB for hero images, under 100KB for thumbnails
- Schema markup:Suggest schema for the generated image:
ImageObjectjson{ "@type": "ImageObject", "url": "https://example.com/images/keyword-description.webp", "width": 1200, "height": 630, "caption": "Descriptive caption with target keyword" } - OG meta tags:For social preview images, remind about:
html
<meta property="og:image" content="https://example.com/images/og-image.webp" /> <meta property="og:image:width" content="1200" /> <meta property="og:image:height" content="630" /> <meta property="og:image:alt" content="Descriptive alt text" />
每次成功生成图像后,需引导用户完成以下操作:
- 替代文本(Alt text):撰写包含关键词、描述准确的替代文本
- 文件命名:重命名为SEO友好格式:
关键词-描述-宽x高.webp - WebP格式转换:转换为WebP格式以优化页面加载速度:
bash
magick output.png -quality 85 output.webp - 文件大小:首图目标大小控制在200KB以内,缩略图控制在100KB以内
- Schema标记:建议为生成的图像添加Schema标记:
ImageObjectjson{ "@type": "ImageObject", "url": "https://example.com/images/keyword-description.webp", "width": 1200, "height": 630, "caption": "包含目标关键词的描述性说明" } - OG元标签:针对社交预览图,提醒添加以下标签:
html
<meta property="og:image" content="https://example.com/images/og-image.webp" /> <meta property="og:image:width" content="1200" /> <meta property="og:image:height" content="630" /> <meta property="og:image:alt" content="描述性替代文本" />
Cost Awareness
成本说明
Image generation costs money. Be transparent:
- Show estimated cost before generating (especially for batch)
- Log every generation:
python3 ~/.claude/skills/seo-image-gen/scripts/cost_tracker.py log --model MODEL --resolution RES --prompt "brief" - Run if user asks about usage
cost_tracker.py summary
Approximate costs (gemini-3.1-flash):
- 512: ~$0.02/image
- 1K resolution: ~$0.04/image
- 2K resolution: ~$0.08/image
- 4K resolution: ~$0.16/image
图像生成会产生费用,需保持透明:
- 生成前显示预估成本(批量生成时尤其重要)
- 记录每一次生成操作:
python3 ~/.claude/skills/seo-image-gen/scripts/cost_tracker.py log --model MODEL --resolution RES --prompt "brief" - 若用户询问使用情况,可运行查看汇总
cost_tracker.py summary
大致成本(基于gemini-3.1-flash):
- 512分辨率:约$0.02/张
- 1K分辨率:约$0.04/张
- 2K分辨率:约$0.08/张
- 4K分辨率:约$0.16/张
Model Routing
模型路由策略
| Scenario | Model | Why |
|---|---|---|
| OG images, social previews | | Fast, cost-effective |
| Hero images, product photos | | Quality + detail |
| Infographics with text | | Better text rendering |
| Quick drafts | | Rapid iteration |
| 场景 | 模型 | 原因 |
|---|---|---|
| OG图、社交预览图 | | 速度快、性价比高 |
| 首图、产品摄影图 | | 兼顾质量与细节 |
| 含文本的信息图 | | 文本渲染效果更好 |
| 快速草稿 | | 迭代速度快 |
Error Handling
错误处理
| Error | Resolution |
|---|---|
| MCP not configured | Run |
| API key invalid | New key at https://aistudio.google.com/apikey |
| Rate limited (429) | Wait 60s, retry. Free tier: ~10 RPM / ~500 RPD |
| Rephrase prompt - see |
| MCP unavailable | Fall back: |
| Extension not installed | Show install instructions: |
| 错误类型 | 解决方法 |
|---|---|
| MCP未配置 | 运行 |
| API密钥无效 | 前往https://aistudio.google.com/apikey获取新密钥 |
| 请求受限(429错误) | 等待60秒后重试。免费额度限制:约10次/分钟 / 500次/天 |
| 重新表述提示词 - 参考 |
| MCP不可用 | 备用方案: |
| 扩展未安装 | 展示安装说明: |
Cross-Skill Integration
跨技能集成
- seo-images (analysis) feeds into seo-image-gen (generation): audit results from identify missing or low-quality images; use those findings to drive
/seo imagescommands/seo image-gen - seo-audit spawns the seo-image-gen agent (not this skill) to analyze OG/social images across the site and produce a prioritized generation plan
- seo-schema can consume generated images: after generation, suggest schema markup pointing to the new assets
ImageObject
- seo-images(分析模块)为seo-image-gen(生成模块)提供输入:的审计结果可识别缺失或低质量图像,进而驱动
/seo images命令的执行/seo image-gen - seo-audit会启动seo-image-gen的agent(非本技能),用于分析全站的OG/社交图像并生成优先级明确的制作计划
- seo-schema可调用生成的图像:生成完成后,可建议添加指向新资产的Schema标记
ImageObject
Reference Documentation
参考文档
Load on-demand. Do NOT load all at startup:
- :6-component system, domain modes, templates
references/prompt-engineering.md - :Model specs, rate limits, capabilities
references/gemini-models.md - :MCP tool parameters and responses
references/mcp-tools.md - :ImageMagick/FFmpeg pipeline recipes
references/post-processing.md - :Pricing, usage tracking
references/cost-tracking.md - :Brand preset management
references/presets.md - :SEO-specific preset templates
references/seo-image-presets.md
按需加载,请勿在启动时全部加载:
- :6组件系统、领域模式、模板
references/prompt-engineering.md - :模型规格、速率限制、功能特性
references/gemini-models.md - :MCP工具参数与响应格式
references/mcp-tools.md - :ImageMagick/FFmpeg工作流方案
references/post-processing.md - :定价、使用量追踪
references/cost-tracking.md - :品牌预设管理
references/presets.md - :SEO专属预设模板
references/seo-image-presets.md
Response Format
响应格式
After generating, always provide:
- Image path:where it was saved
- Crafted prompt:show what was sent to the API (educational)
- Settings:model, aspect ratio, resolution
- SEO checklist:alt text suggestion, file naming, WebP conversion
- Schema snippet:ImageObject or og:image markup if applicable
生成完成后,需始终提供以下内容:
- 图像路径:保存位置
- 最终提示词:展示发送至API的提示词(用于教学参考)
- 配置信息:使用的模型、宽高比、分辨率
- SEO检查清单:替代文本建议、文件命名、WebP转换提示
- Schema代码片段:适用时提供ImageObject或og:image标记代码