pollinations-ai

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Pollinations.ai Image Generation

Pollinations.ai 图片生成

Free, open-source AI image generation through simple URL parameters. No API key or signup required.
通过简单的URL参数实现免费、开源的AI图片生成。无需API密钥或注册。

When to use this skill

何时使用该技能

  • Quick prototyping: Generate placeholder images instantly
  • Marketing assets: Create hero images, banners, social media content
  • Creative exploration: Test multiple styles and compositions rapidly
  • No-budget projects: Free alternative to paid image generation services
  • Automated workflows: Script-friendly URL-based API

  • 快速原型制作:即时生成占位图片
  • 营销素材制作:生成首页横幅、广告图、社交媒体内容
  • 创意探索:快速测试多种风格和构图
  • 零预算项目:付费图片生成服务的免费替代方案
  • 自动化工作流:支持脚本调用的基于URL的API

Instructions

使用说明

Step 1: Understand the API Structure

步骤1:了解API结构

Pollinations.ai uses a simple URL-based API:
https://image.pollinations.ai/prompt/{YOUR_PROMPT}?{PARAMETERS}
No authentication required - just construct the URL and fetch the image.
Available Parameters:
  • width
    /
    height
    : Resolution (default: 1024x1024)
  • model
    : AI model (
    flux
    ,
    turbo
    ,
    stable-diffusion
    )
  • seed
    : Number for reproducible results
  • nologo
    :
    true
    to remove watermark (if supported)
  • enhance
    :
    true
    for automatic prompt enhancement
Pollinations.ai 使用简单的基于URL的API:
https://image.pollinations.ai/prompt/{YOUR_PROMPT}?{PARAMETERS}
无需身份验证 - 只需构造URL即可获取图片。
可用参数:
  • width
    /
    height
    : 分辨率(默认值:1024x1024)
  • model
    : AI模型(
    flux
    ,
    turbo
    ,
    stable-diffusion
  • seed
    : 用于生成可复现结果的数值
  • nologo
    : 设置为
    true
    以移除水印(若支持)
  • enhance
    : 设置为
    true
    以自动优化提示词

Step 2: Craft Your Prompt

步骤2:编写提示词

Use descriptive prompts with specific details:
Good prompt structure:
[Subject], [Style], [Lighting], [Mood], [Composition], [Quality modifiers]
Example:
A father welcoming a beautiful holiday, warm golden hour lighting, 
cozy interior background with festive decorations, 8k resolution, 
highly detailed, cinematic depth of field
Prompt styles:
  • Photorealistic: "photorealistic shot, 8k resolution, highly detailed, cinematic"
  • Illustrative: "digital illustration, soft pastel colors, disney style animation"
  • Minimalist: "minimalist vector art, flat design, simple geometric shapes"
使用包含具体细节的描述性提示词:
优质提示词结构:
[主体], [风格], [光线], [氛围], [构图], [画质修饰词]
示例:
一位父亲迎接美好假期,温暖的黄金时段光线,带有节日装饰的温馨室内背景,8K分辨率,细节丰富,电影级景深
提示词风格:
  • 写实风格:"写实拍摄,8K分辨率,细节丰富,电影质感"
  • 插画风格:"数字插画,柔和马卡龙色调,迪士尼动画风格"
  • 极简风格:"极简矢量图,扁平化设计,简单几何图形"

Step 3: Generate via URL (Browser Method)

步骤3:通过URL生成(浏览器方法)

Simply open the URL in a browser or use
curl
:
bash
undefined
直接在浏览器中打开URL,或使用
curl
命令:
bash
undefined

Basic generation

基础生成

With parameters

带参数生成

Step 4: Generate and Save (Python Method)

步骤4:生成并保存(Python方法)

For automation and file management:
python
import requests
from urllib.parse import quote

def generate_image(prompt, output_file, width=1920, height=1080, model="flux", seed=None):
    """
    Generate image using Pollinations.ai and save to file
    
    Args:
        prompt: Description of the image to generate
        output_file: Path to save the image
        width: Image width in pixels
        height: Image height in pixels
        model: AI model ('flux', 'turbo', 'stable-diffusion')
        seed: Optional seed for reproducibility
    """
    # Encode prompt for URL
    encoded_prompt = quote(prompt)
    url = f"https://image.pollinations.ai/prompt/{encoded_prompt}"
    
    # Build parameters
    params = {
        "width": width,
        "height": height,
        "model": model,
        "nologo": "true"
    }
    if seed:
        params["seed"] = seed
    
    # Generate and save
    print(f"Generating: {prompt[:50]}...")
    response = requests.get(url, params=params)
    
    if response.status_code == 200:
        with open(output_file, "wb") as f:
            f.write(response.content)
        print(f"✓ Saved to {output_file}")
        return True
    else:
        print(f"✗ Error: {response.status_code}")
        return False
适用于自动化和文件管理场景:
python
import requests
from urllib.parse import quote

def generate_image(prompt, output_file, width=1920, height=1080, model="flux", seed=None):
    """
    使用Pollinations.ai生成图片并保存到文件
    
    参数:
        prompt: 要生成的图片描述
        output_file: 图片保存路径
        width: 图片宽度(像素)
        height: 图片高度(像素)
        model: AI模型('flux', 'turbo', 'stable-diffusion')
        seed: 可选参数,用于结果复现
    """
    # 对提示词进行URL编码
    encoded_prompt = quote(prompt)
    url = f"https://image.pollinations.ai/prompt/{encoded_prompt}"
    
    # 构建参数
    params = {
        "width": width,
        "height": height,
        "model": model,
        "nologo": "true"
    }
    if seed:
        params["seed"] = seed
    
    # 生成并保存
    print(f"生成中: {prompt[:50]}...")
    response = requests.get(url, params=params)
    
    if response.status_code == 200:
        with open(output_file, "wb") as f:
            f.write(response.content)
        print(f"✓ 已保存到 {output_file}")
        return True
    else:
        print(f"✗ 错误: {response.status_code}")
        return False

Example usage

使用示例

generate_image( prompt="A father welcoming a beautiful holiday, warm lighting, festive decorations", output_file="holiday_father.jpg", width=1920, height=1080, model="flux", seed=12345 )
undefined
generate_image( prompt="一位父亲迎接美好假期,温暖光线,节日装饰", output_file="holiday_father.jpg", width=1920, height=1080, model="flux", seed=12345 )
undefined

Step 5: Batch Generation

步骤5:批量生成

Generate multiple variations:
python
prompts = [
    "photorealistic shot of a father at front door, warm lighting, festive decorations",
    "digital illustration of a father in snow, magical winter wonderland, disney style",
    "minimalist silhouette of father and child, holiday fireworks, flat design"
]

for i, prompt in enumerate(prompts):
    generate_image(
        prompt=prompt,
        output_file=f"variant_{i+1}.jpg",
        width=1920,
        height=1080,
        model="flux"
    )
生成多张变体图片:
python
prompts = [
    "父亲在前门的写实照片,温暖光线,节日装饰",
    "父亲在雪地中的数字插画,梦幻冬日仙境,迪士尼风格",
    "父子的极简剪影,节日烟花,扁平化设计"
]

for i, prompt in enumerate(prompts):
    generate_image(
        prompt=prompt,
        output_file=f"variant_{i+1}.jpg",
        width=1920,
        height=1080,
        model="flux"
    )

Step 6: Document Your Generations

步骤6:记录生成信息

Save metadata for reproducibility:
python
import json
from datetime import datetime

metadata = {
    "prompt": prompt,
    "model": "flux",
    "width": 1920,
    "height": 1080,
    "seed": 12345,
    "output_file": "holiday_father.jpg",
    "timestamp": datetime.now().isoformat()
}

with open("generation_metadata.json", "w") as f:
    json.dump(metadata, f, indent=2)

保存元数据以便复现:
python
import json
from datetime import datetime

metadata = {
    "prompt": prompt,
    "model": "flux",
    "width": 1920,
    "height": 1080,
    "seed": 12345,
    "output_file": "holiday_father.jpg",
    "timestamp": datetime.now().isoformat()
}

with open("generation_metadata.json", "w") as f:
    json.dump(metadata, f, indent=2)

Examples

示例

Example 1: Hero Image for Website

示例1:网站首页横幅图片

python
generate_image(
    prompt="serene mountain landscape at sunset, wide 16:9, minimal style, soft gradients in blue tones, clean lines, modern aesthetic",
    output_file="hero-image.jpg",
    width=1920,
    height=1080,
    model="flux"
)
Expected output: 16:9 landscape image, minimal style, blue color palette
python
generate_image(
    prompt="日落时分的宁静山地景观,16:9宽幅,极简风格,蓝色调柔和渐变,简洁线条,现代美学",
    output_file="hero-image.jpg",
    width=1920,
    height=1080,
    model="flux"
)
预期输出:16:9比例的景观图片,极简风格,蓝色调色板

Example 2: Product Thumbnail

示例2:产品缩略图

python
generate_image(
    prompt="futuristic dashboard UI, 1:1 square, clean interface, soft lighting, professional feel, dark theme, subtle glow effects",
    output_file="product-thumb.jpg",
    width=1024,
    height=1024,
    model="flux"
)
Expected output: Square thumbnail, dark theme, app store ready
python
generate_image(
    prompt="未来感仪表盘UI,1:1正方形,简洁界面,柔和光线,专业质感,深色主题,微妙发光效果",
    output_file="product-thumb.jpg",
    width=1024,
    height=1024,
    model="flux"
)
预期输出:正方形缩略图,深色主题,符合应用商店规范

Example 3: Social Media Banner

示例3:社交媒体横幅

python
generate_image(
    prompt="LinkedIn banner for SaaS startup, modern gradient background, abstract geometric shapes, colors from purple to blue, space for text on left side",
    output_file="linkedin-banner.jpg",
    width=1584,
    height=396,
    model="flux"
)
Expected output: LinkedIn-optimized dimensions (1584x396), text-safe zone
python
generate_image(
    prompt="SaaS初创公司的LinkedIn横幅,现代渐变背景,抽象几何图形,紫蓝色调,左侧预留文字空间",
    output_file="linkedin-banner.jpg",
    width=1584,
    height=396,
    model="flux"
)
预期输出:符合LinkedIn尺寸要求(1584x396),带有安全文字区域

Example 4: Batch Variations with Seeds

示例4:带种子值的批量变体生成

python
undefined
python
undefined

Generate 4 variations of the same prompt with different seeds

使用不同种子值生成同提示词的4种变体

base_prompt = "A father welcoming a beautiful holiday, cinematic lighting"
for seed in [100, 200, 300, 400]: generate_image( prompt=base_prompt, output_file=f"variation_seed_{seed}.jpg", width=1920, height=1080, model="flux", seed=seed )

**Expected output**: 4 similar images with subtle variations

---
base_prompt = "一位父亲迎接美好假期,电影级光线"
for seed in [100, 200, 300, 400]: generate_image( prompt=base_prompt, output_file=f"variation_seed_{seed}.jpg", width=1920, height=1080, model="flux", seed=seed )

**预期输出**:4张相似但略有差异的图片

---

Best practices

最佳实践

  1. Use specific prompts: Include style, lighting, mood, and quality modifiers
  2. Specify dimensions early: Prevents unintended cropping
  3. Use seeds for consistency: Same seed + prompt = same image
  4. Model selection:
    • flux
      : Highest quality, slower
    • turbo
      : Fast iterations
    • stable-diffusion
      : Balanced
  5. Save metadata: Track prompts, seeds, and parameters for reproducibility
  6. Batch similar requests: Generate style sets with consistent parameters
  7. URL encode prompts: Use
    urllib.parse.quote()
    for special characters

  1. 使用具体提示词:包含风格、光线、氛围和画质修饰词
  2. 提前指定尺寸:避免意外裁剪
  3. 使用种子值保证一致性:相同种子值+提示词=相同图片
  4. 模型选择:
    • flux
      : 画质最高,速度较慢
    • turbo
      : 快速迭代
    • stable-diffusion
      : 平衡画质与速度
  5. 保存元数据:记录提示词、种子值和参数以便复现
  6. 批量相似请求:使用一致参数生成风格统一的图片集
  7. 对提示词进行URL编码:使用
    urllib.parse.quote()
    处理特殊字符

Common pitfalls

常见误区

  • Vague prompts: Add specific details about style, lighting, and composition
  • Ignoring aspect ratios: Check target platform requirements (Instagram 1:1, LinkedIn 1584x396, etc.)
  • Overly complex scenes: Simplify for clarity and better results
  • Not saving metadata: Difficult to reproduce or iterate on successful images
  • Forgetting URL encoding: Special characters break URLs

  • 模糊的提示词:补充关于风格、光线和构图的具体细节
  • 忽略宽高比:确认目标平台的要求(Instagram 1:1,LinkedIn 1584x396等)
  • 过于复杂的场景:简化描述以获得更清晰、更好的结果
  • 未保存元数据:难以复现或优化成功生成的图片
  • 忘记URL编码:特殊字符会导致URL失效

Troubleshooting

故障排除

Issue: Inconsistent outputs

问题:输出结果不一致

Cause: No seed specified Solution: Use a fixed seed for reproducible results
python
generate_image(prompt="...", seed=12345, ...)  # Same output every time
原因:未指定种子值 解决方案:使用固定种子值确保结果可复现
python
generate_image(prompt="...", seed=12345, ...)  # 每次输出都相同

Issue: Wrong aspect ratio

问题:宽高比错误

Cause: Incorrect width/height parameters Solution: Use platform-specific dimensions
python
undefined
原因:width/height参数设置错误 解决方案:使用平台专属尺寸
python
undefined

Instagram: 1:1

Instagram: 1:1

generate_image(prompt="...", width=1080, height=1080)
generate_image(prompt="...", width=1080, height=1080)

LinkedIn banner: ~4:1

LinkedIn横幅: ~4:1

generate_image(prompt="...", width=1584, height=396)
generate_image(prompt="...", width=1584, height=396)

YouTube thumbnail: 16:9

YouTube缩略图: 16:9

generate_image(prompt="...", width=1280, height=720)
undefined
generate_image(prompt="...", width=1280, height=720)
undefined

Issue: Image doesn't match brand colors

问题:图片与品牌色调不符

Cause: No color specification in prompt Solution: Include HEX codes or color names
python
prompt = "landscape with brand colors deep blue #2563EB and purple #8B5CF6"
原因:提示词中未指定颜色 解决方案:包含十六进制颜色码或颜色名称
python
prompt = "包含品牌色深蓝色#2563EB和紫色#8B5CF6的景观图"

Issue: Request fails (HTTP error)

问题:请求失败(HTTP错误)

Cause: Network issue or service downtime Solution: Add retry logic
python
import time

def generate_with_retry(prompt, output_file, max_retries=3):
    for attempt in range(max_retries):
        if generate_image(prompt, output_file):
            return True
        print(f"Retry {attempt + 1}/{max_retries}...")
        time.sleep(2)
    return False

原因:网络问题或服务停机 解决方案:添加重试逻辑
python
import time

def generate_with_retry(prompt, output_file, max_retries=3):
    for attempt in range(max_retries):
        if generate_image(prompt, output_file):
            return True
        print(f"重试 {attempt + 1}/{max_retries}...")
        time.sleep(2)
    return False

Output format

输出格式

markdown
undefined
markdown
undefined

Image Generation Report

图片生成报告

Request

请求信息

  • Prompt: [full prompt text]
  • Model: flux
  • Dimensions: 1920x1080
  • Seed: 12345
  • 提示词:[完整提示词文本]
  • 模型:flux
  • 尺寸:1920x1080
  • 种子值:12345

Output Files

输出文件

  1. hero-image-v1.jpg
    - Primary variant
  2. hero-image-v2.jpg
    - Alternative style
  3. hero-image-v3.jpg
    - Different lighting
  1. hero-image-v1.jpg
    - 主要变体
  2. hero-image-v2.jpg
    - 替代风格
  3. hero-image-v3.jpg
    - 不同光线效果

Metadata

元数据

  • Generated: 2026-02-13T14:30:00Z
  • Iterations: 3
  • Selected: hero-image-v1.jpg
  • 生成时间:2026-02-13T14:30:00Z
  • 迭代次数:3
  • 选中版本:hero-image-v1.jpg

Usage Notes

使用说明

  • Best for: Website hero section
  • Format: JPEG, 1920x1080
  • Reproducible: Yes (seed: 12345)

---
  • 最佳用途:网站首页横幅
  • 格式:JPEG,1920x1080
  • 可复现:是(种子值:12345)

---

Multi-Agent Workflow

多Agent工作流

Validation & Quality Check

验证与质量检查

  • Round 1 (Orchestrator - Claude):
    • Validate prompt completeness
    • Check dimension requirements
    • Verify seed consistency
  • Round 2 (Executor - Codex):
    • Execute generation script
    • Save files with proper naming
    • Generate metadata JSON
  • Round 3 (Analyst - Gemini):
    • Review style consistency
    • Check brand alignment
    • Suggest prompt improvements
  • 第一轮(协调器 - Claude):
    • 验证提示词完整性
    • 检查尺寸要求
    • 确认种子值一致性
  • 第二轮(执行器 - Codex):
    • 执行生成脚本
    • 按规范命名并保存文件
    • 生成元数据JSON
  • 第三轮(分析师 - Gemini):
    • 检查风格一致性
    • 验证品牌契合度
    • 提供提示词优化建议

Agent Roles

Agent角色

AgentRoleTools
ClaudePrompt engineering, quality validationWrite, Read
CodexScript execution, batch processingBash, Write
GeminiStyle analysis, brand consistency checkRead, ask-gemini
Agent角色工具
Claude提示词工程、质量验证编写、读取
Codex脚本执行、批量处理Bash、编写
Gemini风格分析、品牌一致性检查读取、ask-gemini

Example Multi-Agent Workflow

多Agent工作流示例

bash
undefined
bash
undefined

1. Claude: Generate prompts and script

1. Claude:生成提示词和脚本

2. Codex: Execute generation

2. Codex:执行生成任务

bash -c "python generate_images.py"
bash -c "python generate_images.py"

3. Gemini: Review outputs

3. Gemini:审核输出结果

ask-gemini "@outputs/ Analyze brand consistency of generated images"

---
ask-gemini "@outputs/ 分析生成图片的品牌一致性"

---

Metadata

元数据

Version

版本

  • Current Version: 1.0.0
  • Last Updated: 2026-02-13
  • Compatible Platforms: Claude, ChatGPT, Gemini, Codex
  • 当前版本:1.0.0
  • 最后更新:2026-02-13
  • 兼容平台:Claude、ChatGPT、Gemini、Codex

Related Skills

相关技能

  • image-generation - MCP-based image generation
  • design-system - Design system implementation
  • presentation-builder - Presentation creation
  • image-generation - 基于MCP的图片生成
  • design-system - 设计系统实现
  • presentation-builder - 演示文稿制作

API Documentation

API文档

Tags

标签

#pollinations
#image-generation
#free
#api
#url-based
#no-signup
#creative
#pollinations
#image-generation
#free
#api
#url-based
#no-signup
#creative