返回 Skill 列表
extension
分类: 内容与媒体无需 API Key

banana

使用Deno和Google的Gemini图像生成模型生成图像。当用户想要创建AI生成的图像、执行图像到图像的转换或根据文本提示生成视觉内容时,请使用此技能。触发条件包括“生成...的图像”、“创建...的图片”、“制作带有...的图像”或“将此图像转换为...”等请求。

person作者: jakexiaohubgithub

Banana Image Generation Skill

Generate images using Google's Gemini 2.0 Flash image generation model, running with Deno.

Quick Start

Generate an image from a text prompt:

deno run --allow-all scripts/generate-image.ts "A cat eating a nano-banana in a fancy restaurant"

Transform an existing image:

deno run --allow-all scripts/generate-image.ts "Make this cat wear a top hat" --input cat.png --output fancy-cat.png

Requirements

  • GOOGLE_API_KEY environment variable must be set
  • Deno runtime

Script Usage

The scripts/generate-image.ts script supports:

| Flag | Description | |------|-------------| | <prompt> | Text description of the image to generate (required) | | --input <path> | Input image for image-to-image generation (optional) | | --output <path> | Output path for generated image (default: generated-image.png) |

Examples

Text-to-image:

deno run --allow-all scripts/generate-image.ts "A futuristic city at sunset"

Image-to-image with custom output:

deno run --allow-all scripts/generate-image.ts "Add a rainbow to the sky" --input landscape.jpg --output rainbow-landscape.png

Programmatic Usage

Import and use in Deno scripts:

import { generateImage } from "./scripts/generate-image.ts";

await generateImage({
  prompt: "A nano-banana floating in space",
  outputPath: "space-banana.png"
});

With input image:

await generateImage({
  prompt: "Make this banana purple",
  imagePath: "banana.png",
  outputPath: "purple-banana.png"
});