| 1 | --- |
| 2 | name: generating-images |
| 3 | description: Generates images using AI models (Gemini). AI图像生成、文生图、生成图片。 |
| 4 | --- |
| 5 | |
| 6 | # Image Generation |
| 7 | |
| 8 | Generates images using Gemini AI model (default: gemini-3.1-flash-image-preview, compatible: gemini-3-pro-image-preview). |
| 9 | |
| 10 | ## Parameters |
| 11 | |
| 12 | ### Required |
| 13 | |
| 14 | - `prompt`: Creative description of the image |
| 15 | |
| 16 | ### Optional |
| 17 | |
| 18 | - `imageUrls`: Reference image URLs for editing |
| 19 | - `imageSize`: Output resolution - "1K", "2K", "4K" |
| 20 | - `aspectRatio`: "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9" |
| 21 | |
| 22 | ## Workflow |
| 23 | |
| 24 | 1. Call `generateImage` with prompt and optional parameters |
| 25 | 2. Image generation is synchronous - returns URL immediately |
| 26 | |
| 27 | ## Multiple Images Strategy |
| 28 | |
| 29 | - Call `generateImage` sequentially |
| 30 | - Display each image immediately with progress (e.g., "已生成 1/3") |
| 31 | - Use markdown `` format |
| 32 | |
| 33 | ## Prompt Writing Guide |
| 34 | |
| 35 | ### Core Principle |
| 36 | |
| 37 | **Describe the scene, don't just list keywords.** Narrative descriptions always outperform keyword lists. |
| 38 | |
| 39 | ### Scene Strategies |
| 40 | |
| 41 | #### 1. Photorealistic Scenes |
| 42 | |
| 43 | Include photography terms: lens type, lighting, atmosphere |
| 44 | |
| 45 | - Example: `A photorealistic close-up portrait of an elderly Japanese ceramicist with deep, sun-etched wrinkles and a warm, knowing smile. He is carefully inspecting a freshly glazed tea bowl.` |
| 46 | |
| 47 | #### 2. Stylized Illustrations |
| 48 | |
| 49 | Specify style, features, and background requirements |
| 50 | |
| 51 | - Example: `A kawaii-style sticker of a happy red panda wearing a tiny bamboo hat. It's munching on a green bamboo leaf. The design features bold, clean outlines, simple cel-shading, and a vibrant color palette.` |
| 52 | |
| 53 | #### 3. Text-Accurate Images |
| 54 | |
| 55 | Specify font style, design approach, and color scheme |
| 56 | |
| 57 | - Example: `Create a modern, minimalist logo for a coffee shop called 'The Daily Grind'. The text should be in a clean, bold, sans-serif font. The color scheme is black and white.` |
| 58 | |
| 59 | #### 4. Product Photography |
| 60 | |
| 61 | Describe studio setup, lighting configuration, camera angle in detail |
| 62 | |
| 63 | - Example: `A high-resolution, studio-lit product photograph of a minimalist ceramic coffee mug in matte black, presented on a polished concrete surface.` |
| 64 | |
| 65 | #### 5. Minimalist Design |
| 66 | |
| 67 | Subject positioning strategy, reserve negative space |
| 68 | |
| 69 | - Example: `A minimalist composition featuring a single, delicate red maple leaf positioned in the bottom-right of the frame. The background is a vast, empty off-white canvas.` |
| 70 | |
| 71 | #### 6. Sequential Art (Comics/Storyboards) |
| 72 | |
| 73 | Emphasize character consistency and scene description |
| 74 | |
| 75 | - Example: `Make a 3 panel comic in a gritty, noir art style with high-contrast black and white inks. Put the character in a humorous scene.` |
| 76 | |
| 77 | #### 7. Search-Grounded Graphics |
| 78 | |
| 79 | Combine with search tools to get current events/weather/trends for timely content |
| 80 | |
| 81 | - Example: `Make a simple but stylish graphic of last night's Arsenal game in the Champion's League` |
| 82 | |
| 83 | ## Language Guidelines |
| 84 | |
| 85 | Text in generated images MUST match user's language. |
| 86 | |
| 87 | ## Examples |
| 88 | |
| 89 | ### Photorealistic Scene |
| 90 | |
| 91 | ``` |
| 92 | generateImage: |
| 93 | prompt: "A photorealistic close-up portrait of an elderly Japanese ceramicist with deep, sun-etched wrinkles and a warm, knowing smile. He is carefully inspecting a freshly glazed tea bowl." |
| 94 | aspectRatio: "3:4" |
| 95 | imageSize: "2K" |
| 96 | ``` |
| 97 | |
| 98 | ### Stylized Illustration |
| 99 | |
| 100 | ``` |
| 101 | generateImage: |
| 102 | prompt: "A kawaii-style sticker of a happy red panda wearing a tiny bamboo hat. It's munching on a green bamboo leaf. The design features bold, clean outlines, simple cel-shading, and a vibrant color palette." |
| 103 | aspectRatio: "1:1" |
| 104 | imageSize: "1K" |
| 105 | ``` |
| 106 | |
| 107 | ### Product Photography |
| 108 | |
| 109 | ``` |
| 110 | generateImage: |
| 111 | prompt: "A high-resolution, studio-lit product photograph of a minimalist ceramic coffee mug in matte black, presented on a polished concrete surface." |
| 112 | aspectRatio: "1:1" |
| 113 | imageSize: "2K" |
| 114 | ``` |
| 115 | |
| 116 | ### Minimalist Design |
| 117 | |
| 118 | ``` |
| 119 | generateImage: |
| 120 | prompt: "A minimalist composition featuring a single, delicate red maple leaf positioned in the bottom-right of the frame. The background is a vast, empty off-white canvas." |
| 121 | aspectRatio: "16:9" |
| 122 | imageSize: "2K" |
| 123 | ``` |
| 124 | |
| 125 | ### Image Editing |
| 126 | |
| 127 | ``` |
| 128 | generateImage: |
| 129 | prompt: "Add a vibrant rainbow to the sky, keep all other elements unchanged" |
| 130 | imageUrls: ["source.jpg"] |
| 131 | ``` |
| 132 |