mcpField
P
pollinations-image-gen

pollinations-image-gen

github.com/xream创意与媒体255182 次安装3 周前更新
代码仓库

关于 pollinations-image-gen

pollinations-image-gen 是通过 Pollinations.ai API 根据文本描述生成图像的技能,面向需要命令行生成图像的用户。它支持多种模型,并可设置尺寸、参考图、种子和输出选项。

主要功能

  1. 01通过文本描述生成图像
  2. 02选择可用的生成模型
  3. 03设置图像尺寸与随机种子
  4. 04使用参考图和反向提示词
  5. 05配置安全过滤、质量与透明背景

适用场景

  1. 01生成文本描述对应的图像
  2. 02按指定尺寸生成横幅或方形图片
  3. 03用固定种子复现生成结果
  4. 04以参考图或透明背景生成素材

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/xream/scripts --skill pollinations-image-gen

安装后在 Claude Code 中输入/pollinations-image-gen确认已加载。

附带文件scripts/generate.mjs

详细介绍

Pollinations 图像生成

使用 Pollinations.ai API 根据文本描述生成图像。

适用场景

  • 用户要求生成、创作、绘制或渲染图像
  • 用户提到 Pollinations 或任何受支持的模型名称

使用方法

使用 node 运行 {baseDir}/scripts/generate.mjs 生成脚本。通过 --key value CLI 标志传入所有参数。

必需参数
参数说明
--prompt要生成的图像的文本描述。请根据用户的请求编写详细、高质量的提示词。
--model要使用的 AI 模型(见下方模型列表)
可选参数
参数说明默认值
--output输出文件路径。父目录会自动创建。如果省略,则使用带时间戳的文件名保存到当前目录auto
--width图像宽度(像素)1024
--height图像高度(像素)1024
--seed用于获得可复现结果的随机种子。使用 -1 表示随机0
--enhance设置为 true,让 AI 优化提示词以获得更好的效果false
--negative_prompt图像中需要避免的内容"worst quality, blurry"
--safe设置为 true 以启用安全内容过滤器false
--quality图像质量:low、medium、high、hd(仅限 gptimage)medium
--image参考图像 URL;多个 URL 使用逗号或竖线分隔-
--transparent设置为 true 以使用透明背景(仅限 gptimage)false
可用模型

免费模型(始终可用):

  • flux — 快速、高质量的图像生成(默认)
  • zimage — 高质量图像生成
  • imagen-4 — Google Imagen 4
  • klein — Klein 图像生成
  • klein-large — Klein 大尺寸图像生成
  • gptimage — GPT Image(支持质量和透明背景选项)

付费模型(需要设置 POLLINATIONS_PAID=true):

  • seedream / seedream-pro — Seedream 图像生成
  • kontext — Kontext 模型
  • nanobanana / nanobanana-pro — NanoBanana 图像生成
  • gptimage-large — GPT Image 大尺寸版本

示例

基础用法:仅提供提示词和模型
node {baseDir}/scripts/generate.mjs --prompt "a beautiful sunset over mountains" --model flux
自定义尺寸(--width、--height)
node {baseDir}/scripts/generate.mjs --prompt "a panoramic futuristic cityscape at night" --model imagen-4 --width 1536 --height 768
可复现的结果(--seed)
node {baseDir}/scripts/generate.mjs --prompt "a red panda sitting on a branch" --model klein --seed 42
使用 AI 优化提示词(--enhance)
node {baseDir}/scripts/generate.mjs --prompt "cat" --model zimage --enhance true
负面提示词(--negative_prompt)
node {baseDir}/scripts/generate.mjs --prompt "a professional product photo of sneakers" --model flux --negative_prompt "blurry, low quality, watermark, text"
安全过滤器(--safe)
node {baseDir}/scripts/generate.mjs --prompt "a fantasy battle scene" --model klein-large --safe true
质量控制(--quality,仅限 gptimage)
node {baseDir}/scripts/generate.mjs --prompt "an oil painting of a library interior" --model gptimage --quality hd
透明背景(--transparent,仅限 gptimage)
node {baseDir}/scripts/generate.mjs --prompt "a cartoon robot mascot" --model gptimage --transparent true
参考图像(--image)
node {baseDir}/scripts/generate.mjs --prompt "make it look like a watercolor painting" --model kontext --image "https://example.com/photo.jpg"
保存到指定路径(--output)
node {baseDir}/scripts/generate.mjs --prompt "a watercolor landscape" --model flux --output /tmp/landscape.jpg
组合使用多个选项
node {baseDir}/scripts/generate.mjs --prompt "a detailed fantasy map" --model gptimage --width 2048 --height 2048 --quality hd --seed 123 --negative_prompt "blurry, text" --safe true --output ./map.png

重要说明

  • 如果指定了 --output,文件会保存到该路径;否则会在当前目录使用带时间戳的文件名。
  • 模型是否可用取决于 POLLINATIONS_PAID 环境变量。如果 POLLINATIONS_PAID 不是 true,则只能使用免费模型。
  • 根据用户需求选择模型。如果用户没有偏好,图像生成默认使用 flux。
  • 编写提示词时,请尽量详尽、具体,以获得最佳效果。
  • 生成完成后,务必告知用户输出文件路径。

评论

支持 Markdown