[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7A5XS12CXSS7YPXJ6VZSBXP":3,"skill-same:01M7A5XS12CXSS7YPXJ6VZSBXP":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":40,"commitSha":41,"skillDirectory":42,"forksCount":43,"repositoryHtmlUrl":44,"repositoryHomepageUrl":6,"ownerHtmlUrl":45,"ownerBlogUrl":46,"ownerDescription":47,"updatedAt":48,"install":49,"resources":62},"01M7A5XS12CXSS7YPXJ6VZSBXP","image-generator",null,"Generate and edit images using Gemini's Nano Banana Pro model (gemini-3-pro-image-preview). Use this skill when the user asks you to generate images, create visuals, edit photos, create logos, generate product mockups, or perform any image generation\u002Fediting task.","MHassan0000\u002FSkills","MHassan0000","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F224296448?v=4","01M7A14DTC1EZCRN04582533RD","Muhammad Hassan Yousaf","01M7A14DV10KTW8NHQTJPD08X0",1,"MIT","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fantigravity skills\u002Fagentic-awesome-skills\u002Fskills\u002Fimage-generator\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: image-generator\ndescription: Generate and edit images using Gemini's Nano Banana Pro model (gemini-3-pro-image-preview). Use this skill when the user asks you to generate images, create visuals, edit photos, create logos, generate product mockups, or perform any image generation\u002Fediting task.\nallowed-tools: Read, Write, Bash, WebFetch\ncategory: \"media\"\nrisk: \"safe\"\nsource: \"official\"\nsource_repo: \"dair-ai\u002Fdair-academy-plugins\"\nsource_type: \"official\"\ndate_added: \"2026-06-19\"\nauthor: \"DAIR.AI\"\nlicense: \"MIT\"\nlicense_source: \"https:\u002F\u002Fgithub.com\u002Fdair-ai\u002Fdair-academy-plugins\u002Fblob\u002Fmain\u002FREADME.md#license\"\ntags:\n  - dair-academy\n  - ai\n  - workflow\ntools:\n  - claude-code\n  - codex-cli\n  - cursor\n---\n\n# Image Generator\n\n## When to Use\n\nUse when this workflow matches the user request: Generate and edit images using Gemini's Nano Banana Pro model (gemini-3-pro-image-preview). Use this skill when the user asks you to generate images, create visuals, edit photos, create logos, generate product mockups, or perform any image generation\u002Fediting task.\n\n\n_Source: [dair-ai\u002Fdair-academy-plugins](https:\u002F\u002Fgithub.com\u002Fdair-ai\u002Fdair-academy-plugins) (MIT)._\n\nThis skill generates and edits images using Google's Gemini Nano Banana Pro model (`gemini-3-pro-image-preview`).\n\n## IMPORTANT: Setup Required\n\nBefore using this skill, the user must set the `GEMINI_API_KEY` environment variable:\n\n1. Get a free API key from [Google AI Studio](https:\u002F\u002Faistudio.google.com\u002F)\n2. Export the key in your shell profile (`~\u002F.zshrc`, `~\u002F.bashrc`, etc.):\n   ```bash\n   read -rsp \"Gemini API key: \" GEMINI_API_KEY\n   echo\n   export GEMINI_API_KEY\n   ```\n3. Restart your terminal or run `source ~\u002F.zshrc` (or `~\u002F.bashrc`)\n\n**The skill will not work without this configuration.**\n\n## Pre-flight Check\n\nBefore making any API call, verify the key is set:\n\n```bash\nif [ -z \"$GEMINI_API_KEY\" ]; then\n  echo \"ERROR: GEMINI_API_KEY is not set. Please export it in your shell profile.\"\n  exit 1\nfi\n```\n\nIf the key is missing, stop and tell the user to set it using the instructions above.\n\n## Configuration\n\n**Model**: `gemini-3-pro-image-preview`\n\n**API Key**: Read from the `GEMINI_API_KEY` environment variable\n\n## Iterating on User-Provided Images\n\nWhen the user provides a path to an image they want to edit or iterate on, use this workflow:\n\n### Step 1: Read and encode the image to base64\n\n```bash\n# Get the image path from user\nIMG_PATH=\"\u002Fpath\u002Fto\u002Fuser\u002Fimage.png\"\n\n# Detect mime type\nif [[ \"$IMG_PATH\" == *.png ]]; then\n    MIME_TYPE=\"image\u002Fpng\"\nelif [[ \"$IMG_PATH\" == *.jpg ]] || [[ \"$IMG_PATH\" == *.jpeg ]]; then\n    MIME_TYPE=\"image\u002Fjpeg\"\nelif [[ \"$IMG_PATH\" == *.webp ]]; then\n    MIME_TYPE=\"image\u002Fwebp\"\nelse\n    MIME_TYPE=\"image\u002Fpng\"\nfi\n\n# Encode to base64 (works on both macOS and Linux)\nif [[ \"$(uname)\" == \"Darwin\" ]]; then\n    IMG_BASE64=$(base64 -i \"$IMG_PATH\")\nelse\n    IMG_BASE64=$(base64 -w0 \"$IMG_PATH\")\nfi\n```\n\n### Step 2: Send image with edit prompt (File-Based Approach)\n\n**IMPORTANT:** Always use a file-based approach for the request body. Base64-encoded images are too large for command-line arguments and will cause \"argument list too long\" errors.\n\n```bash\n# User's edit request\nEDIT_PROMPT=\"Add a santa hat to the person in this image\"\n\n# Write request to a JSON file (avoids command line length limits)\ncat > \u002Ftmp\u002Fgemini_request.json \u003C\u003C JSONEOF\n{\n  \"contents\": [{\n    \"parts\": [\n      {\"text\": \"$EDIT_PROMPT\"},\n      {\n        \"inline_data\": {\n          \"mime_type\": \"$MIME_TYPE\",\n          \"data\": \"$IMG_BASE64\"\n        }\n      }\n    ]\n  }],\n  \"generationConfig\": {\n    \"responseModalities\": [\"TEXT\", \"IMAGE\"]\n  }\n}\nJSONEOF\n\n# Call the API using the file\ncurl -s -X POST \\\n  \"https:\u002F\u002Fgenerativelanguage.googleapis.com\u002Fv1beta\u002Fmodels\u002Fgemini-3-pro-image-preview:generateContent\" \\\n  -H \"x-goog-api-key: $GEMINI_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d @\u002Ftmp\u002Fgemini_request.json > \u002Ftmp\u002Fgemini_response.json\n```\n\n### Step 3: Extract and save the edited image\n\n```bash\n# Extract image from response and save\npython3 -c \"\nimport json\nimport base64\n\nwith open('\u002Ftmp\u002Fgemini_response.json') as f:\n    data = json.load(f)\n\nfor part in data['candidates'][0]['content']['parts']:\n    if 'inlineData' in part:\n        img_data = part['inlineData']['data']\n        mime = part['inlineData']['mimeType']\n        ext = 'png' if 'png' in mime else 'jpg'\n        with open('edited_image.' + ext, 'wb') as out:\n            out.write(base64.b64decode(img_data))\n        print(f'Saved: edited_image.{ext}')\n    elif 'text' in part:\n        print(part['text'])\n\"\n```\n\n### Complete Example (File-Based)\n\nFor iterating on images, always use file-based requests:\n\n```bash\n# Variables\nIMG_PATH=\"\u002Fpath\u002Fto\u002Fimage.png\"\nEDIT_PROMPT=\"Make the background a sunset beach\"\nOUTPUT_PATH=\"edited_output.png\"\n# Detect mime type and encode\nMIME_TYPE=$([[ \"$IMG_PATH\" == *.png ]] && echo \"image\u002Fpng\" || echo \"image\u002Fjpeg\")\nIMG_BASE64=$(base64 -i \"$IMG_PATH\" 2>\u002Fdev\u002Fnull || base64 -w0 \"$IMG_PATH\")\n\n# Write request to file (required - base64 images are too large for command line)\ncat > \u002Ftmp\u002Fgemini_request.json \u003C\u003C JSONEOF\n{\n  \"contents\": [{\n    \"parts\": [\n      {\"text\": \"$EDIT_PROMPT\"},\n      {\"inline_data\": {\"mime_type\": \"$MIME_TYPE\", \"data\": \"$IMG_BASE64\"}}\n    ]\n  }],\n  \"generationConfig\": {\n    \"responseModalities\": [\"TEXT\", \"IMAGE\"]\n  }\n}\nJSONEOF\n\n# Call API and extract image\ncurl -s -X POST \\\n  \"https:\u002F\u002Fgenerativelanguage.googleapis.com\u002Fv1beta\u002Fmodels\u002Fgemini-3-pro-image-preview:generateContent\" \\\n  -H \"x-goog-api-key: $GEMINI_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d @\u002Ftmp\u002Fgemini_request.json > \u002Ftmp\u002Fgemini_response.json\n\n# Save the output image\npython3 -c \"\nimport json, base64\nwith open('\u002Ftmp\u002Fgemini_response.json') as f:\n    data = json.load(f)\nfor part in data.get('candidates', [{}])[0].get('content', {}).get('parts', []):\n    if 'inlineData' in part:\n        with open('$OUTPUT_PATH', 'wb') as f:\n            f.write(base64.b64decode(part['inlineData']['data']))\n        print('Saved: $OUTPUT_PATH')\n\"\n```\n\n### Multi-Image Input (Combine\u002FCompose)\n\nTo combine elements from multiple images (also uses file-based approach):\n\n```bash\nIMG1_PATH=\"\u002Fpath\u002Fto\u002Fimage1.png\"\nIMG2_PATH=\"\u002Fpath\u002Fto\u002Fimage2.png\"\nPROMPT=\"Put the dress from the first image on the person in the second image\"\nIMG1_BASE64=$(base64 -i \"$IMG1_PATH\" 2>\u002Fdev\u002Fnull || base64 -w0 \"$IMG1_PATH\")\nIMG2_BASE64=$(base64 -i \"$IMG2_PATH\" 2>\u002Fdev\u002Fnull || base64 -w0 \"$IMG2_PATH\")\n\n# Write request to file\ncat > \u002Ftmp\u002Fgemini_request.json \u003C\u003C JSONEOF\n{\n  \"contents\": [{\n    \"parts\": [\n      {\"text\": \"$PROMPT\"},\n      {\"inline_data\": {\"mime_type\": \"image\u002Fpng\", \"data\": \"$IMG1_BASE64\"}},\n      {\"inline_data\": {\"mime_type\": \"image\u002Fpng\", \"data\": \"$IMG2_BASE64\"}}\n    ]\n  }],\n  \"generationConfig\": {\"responseModalities\": [\"TEXT\", \"IMAGE\"]}\n}\nJSONEOF\n\ncurl -s -X POST \\\n  \"https:\u002F\u002Fgenerativelanguage.googleapis.com\u002Fv1beta\u002Fmodels\u002Fgemini-3-pro-image-preview:generateContent\" \\\n  -H \"x-goog-api-key: $GEMINI_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d @\u002Ftmp\u002Fgemini_request.json > \u002Ftmp\u002Fgemini_response.json\n```\n\n## Capabilities\n\n### Text-to-Image Generation\n- Generate high-quality images from text descriptions\n- Support for photorealistic, stylized, and artistic outputs\n- Accurate text rendering in images (logos, infographics, diagrams)\n\n### Image Editing\n- Add or remove elements from images\n- Inpainting with semantic masking (edit specific parts)\n- Style transfer (apply artistic styles to photos)\n- Multi-image composition (combine elements from multiple images)\n\n### Advanced Features\n- **High Resolution**: 1K, 2K, or 4K output\n- **Aspect Ratios**: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9\n- **Google Search Grounding**: Generate images based on real-time data\n- **Multi-turn Editing**: Iteratively refine images through conversation\n- **Up to 14 Reference Images**: Combine multiple inputs for complex compositions\n\n## API Usage\n\n### Basic Text-to-Image (Python)\n\n```python\nfrom google import genai\nfrom google.genai import types\n\nclient = genai.Client()\n\nresponse = client.models.generate_content(\n    model=\"gemini-3-pro-image-preview\",\n    contents=[\"Your prompt here\"],\n    config=types.GenerateContentConfig(\n        response_modalities=['TEXT', 'IMAGE'],\n        image_config=types.ImageConfig(\n            aspect_ratio=\"16:9\",  # Optional\n            image_size=\"2K\"       # Optional: \"1K\", \"2K\", \"4K\"\n        )\n    )\n)\n\nfor part in response.parts:\n    if part.text is not None:\n        print(part.text)\n    elif part.inline_data is not None:\n        image = part.as_image()\n        image.save(\"generated_image.png\")\n```\n\n### Basic Text-to-Image (JavaScript)\n\n```javascript\nimport { GoogleGenAI } from \"@google\u002Fgenai\";\nimport * as fs from \"node:fs\";\n\nconst ai = new GoogleGenAI({});\n\nconst response = await ai.models.generateContent({\n    model: \"gemini-3-pro-image-preview\",\n    contents: \"Your prompt here\",\n    config: {\n        responseModalities: ['TEXT', 'IMAGE'],\n        imageConfig: {\n            aspectRatio: \"16:9\",\n            imageSize: \"2K\"\n        }\n    }\n});\n\nfor (const part of response.candidates[0].content.parts) {\n    if (part.text) {\n        console.log(part.text);\n    } else if (part.inlineData) {\n        const buffer = Buffer.from(part.inlineData.data, \"base64\");\n        fs.writeFileSync(\"generated_image.png\", buffer);\n    }\n}\n```\n\n### REST API (curl)\n\n```bash\ncurl -s -X POST \\\n  \"https:\u002F\u002Fgenerativelanguage.googleapis.com\u002Fv1beta\u002Fmodels\u002Fgemini-3-pro-image-preview:generateContent\" \\\n  -H \"x-goog-api-key: $GEMINI_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"contents\": [{\n      \"parts\": [{\"text\": \"Your prompt here\"}]\n    }],\n    \"generationConfig\": {\n      \"responseModalities\": [\"TEXT\", \"IMAGE\"],\n      \"imageConfig\": {\n        \"aspectRatio\": \"16:9\",\n        \"imageSize\": \"2K\"\n      }\n    }\n  }' | jq -r '.candidates[0].content.parts[] | select(.inlineData) | .inlineData.data' | base64 --decode > output.png\n```\n\n### Image Editing (with input image)\n\n```python\nfrom google import genai\nfrom google.genai import types\nfrom PIL import Image\n\nclient = genai.Client()\n\ninput_image = Image.open('input.png')\nprompt = \"Add a wizard hat to the cat in this image\"\n\nresponse = client.models.generate_content(\n    model=\"gemini-3-pro-image-preview\",\n    contents=[prompt, input_image],\n    config=types.GenerateContentConfig(\n        response_modalities=['TEXT', 'IMAGE']\n    )\n)\n\nfor part in response.parts:\n    if part.inline_data is not None:\n        image = part.as_image()\n        image.save(\"edited_image.png\")\n```\n\n### Multi-Image Composition\n\n```python\nfrom google import genai\nfrom google.genai import types\nfrom PIL import Image\n\nclient = genai.Client()\n\nimage1 = Image.open('dress.png')\nimage2 = Image.open('model.png')\nprompt = \"Put the dress from the first image on the model from the second image\"\n\nresponse = client.models.generate_content(\n    model=\"gemini-3-pro-image-preview\",\n    contents=[image1, image2, prompt],\n    config=types.GenerateContentConfig(\n        response_modalities=['TEXT', 'IMAGE'],\n        image_config=types.ImageConfig(\n            aspect_ratio=\"3:4\",\n            image_size=\"2K\"\n        )\n    )\n)\n```\n\n### With Google Search Grounding\n\n```python\nfrom google import genai\nfrom google.genai import types\n\nclient = genai.Client()\n\nresponse = client.models.generate_content(\n    model=\"gemini-3-pro-image-preview\",\n    contents=\"Visualize the current weather forecast for San Francisco\",\n    config=types.GenerateContentConfig(\n        response_modalities=['TEXT', 'IMAGE'],\n        image_config=types.ImageConfig(aspect_ratio=\"16:9\"),\n        tools=[{\"google_search\": {}}]\n    )\n)\n```\n\n## Prompting Best Practices\n\n### 1. Be Descriptive, Not Keyword-Based\nInstead of: `cat, wizard hat, cute`\nWrite: `A fluffy orange cat wearing a small knitted wizard hat, sitting on a wooden floor with soft natural lighting from a window`\n\n### 2. Specify Style and Mood\n- Photography terms: \"shot with 85mm lens\", \"soft bokeh background\", \"golden hour lighting\"\n- Artistic styles: \"in the style of Van Gogh\", \"minimalist illustration\", \"photorealistic\"\n- Mood: \"warm and cozy atmosphere\", \"dramatic noir lighting\"\n\n### 3. For Text in Images\nBe explicit about:\n- The exact text to render\n- Font style (descriptively): \"clean, bold, sans-serif font\"\n- Placement and size\n\n### 4. For Editing\n- Describe what to change and what to preserve\n- Use \"keep everything else unchanged\"\n- Reference specific elements clearly\n\n### 5. For Product\u002FCommercial Images\nMention:\n- Lighting setup: \"three-point softbox lighting\"\n- Background: \"clean white studio background\"\n- Camera angle: \"slightly elevated 45-degree shot\"\n\n## Resolution and Aspect Ratio Reference\n\n| Aspect Ratio | 1K Resolution | 2K Resolution | 4K Resolution |\n|--------------|---------------|---------------|---------------|\n| 1:1          | 1024x1024     | 2048x2048     | 4096x4096     |\n| 16:9         | 1376x768      | 2752x1536     | 5504x3072     |\n| 9:16         | 768x1376      | 1536x2752     | 3072x5504     |\n| 3:2          | 1264x848      | 2528x1696     | 5056x3392     |\n| 2:3          | 848x1264      | 1696x2528     | 3392x5056     |\n\n## Common Use Cases\n\n### Logo Creation\n```\nCreate a modern, minimalist logo for a coffee shop called 'The Daily Grind'.\nThe text should be in a clean, bold, sans-serif font.\nBlack and white color scheme. Put the logo in a circle.\n```\n\n### Product Photography\n```\nA high-resolution, studio-lit product photograph of a minimalist ceramic\ncoffee mug in matte black on a polished concrete surface. Three-point\nsoftbox lighting with soft, diffused highlights. Slightly elevated\n45-degree camera angle. Sharp focus on steam rising from the coffee.\n```\n\n### Style Transfer\n```\nTransform this photograph of a city street at night into Vincent van Gogh's\n'Starry Night' style. Preserve the composition but render with swirling,\nimpasto brushstrokes and deep blues with bright yellows.\n```\n\n### Infographic\n```\nCreate a vibrant infographic explaining photosynthesis as a recipe.\nShow \"ingredients\" (sunlight, water, CO2) and \"finished dish\" (sugar\u002Fenergy).\nStyle like a colorful kids' cookbook, suitable for 4th graders.\n```\n\n## Error Handling\n\nCommon issues:\n- **No image returned**: Check that `response_modalities` includes `'IMAGE'`\n- **Safety filters**: Some prompts may be blocked; try rephrasing\n- **Rate limits**: Implement exponential backoff for retries\n- **Large images**: For 4K, ensure sufficient timeout settings\n\n## Dependencies\n\nTo use the Python SDK:\n```bash\npip install google-genai pillow\n```\n\nFor JavaScript:\n```bash\nnpm install @google\u002Fgenai\n```\n\n## Important Notes\n\n- All generated images include a SynthID watermark\n- The model uses a \"thinking\" process for complex prompts\n- For best text rendering, generate text first, then request image with that text\n- Images are not stored by the API - save outputs locally\n\n\n## Limitations\n\n- Requires the upstream tool, account, API key, or local setup when the workflow names one.\n- Does not authorize destructive, production, paid, or external-message actions without explicit user approval.\n- Validate generated artifacts or recommendations against the user's real sources before treating them as final.\n","# Image Generator\n\n## When to Use\n\nUse when this workflow matches the user request: Generate and edit images using Gemini's Nano Banana Pro model (gemini-3-pro-image-preview). Use this skill when the user asks you to generate images, create visuals, edit photos, create logos, generate product mockups, or perform any image generation\u002Fediting task.\n\n\n_Source: [dair-ai\u002Fdair-academy-plugins](https:\u002F\u002Fgithub.com\u002Fdair-ai\u002Fdair-academy-plugins) (MIT)._\n\nThis skill generates and edits images using Google's Gemini Nano Banana Pro model (`gemini-3-pro-image-preview`).\n\n## IMPORTANT: Setup Required\n\nBefore using this skill, the user must set the `GEMINI_API_KEY` environment variable:\n\n1. Get a free API key from [Google AI Studio](https:\u002F\u002Faistudio.google.com\u002F)\n2. Export the key in your shell profile (`~\u002F.zshrc`, `~\u002F.bashrc`, etc.):\n   ```bash\n   read -rsp \"Gemini API key: \" GEMINI_API_KEY\n   echo\n   export GEMINI_API_KEY\n   ```\n3. Restart your terminal or run `source ~\u002F.zshrc` (or `~\u002F.bashrc`)\n\n**The skill will not work without this configuration.**\n\n## Pre-flight Check\n\nBefore making any API call, verify the key is set:\n\n```bash\nif [ -z \"$GEMINI_API_KEY\" ]; then\n  echo \"ERROR: GEMINI_API_KEY is not set. Please export it in your shell profile.\"\n  exit 1\nfi\n```\n\nIf the key is missing, stop and tell the user to set it using the instructions above.\n\n## Configuration\n\n**Model**: `gemini-3-pro-image-preview`\n\n**API Key**: Read from the `GEMINI_API_KEY` environment variable\n\n## Iterating on User-Provided Images\n\nWhen the user provides a path to an image they want to edit or iterate on, use this workflow:\n\n### Step 1: Read and encode the image to base64\n\n```bash\n# Get the image path from user\nIMG_PATH=\"\u002Fpath\u002Fto\u002Fuser\u002Fimage.png\"\n\n# Detect mime type\nif [[ \"$IMG_PATH\" == *.png ]]; then\n    MIME_TYPE=\"image\u002Fpng\"\nelif [[ \"$IMG_PATH\" == *.jpg ]] || [[ \"$IMG_PATH\" == *.jpeg ]]; then\n    MIME_TYPE=\"image\u002Fjpeg\"\nelif [[ \"$IMG_PATH\" == *.webp ]]; then\n    MIME_TYPE=\"image\u002Fwebp\"\nelse\n    MIME_TYPE=\"image\u002Fpng\"\nfi\n\n# Encode to base64 (works on both macOS and Linux)\nif [[ \"$(uname)\" == \"Darwin\" ]]; then\n    IMG_BASE64=$(base64 -i \"$IMG_PATH\")\nelse\n    IMG_BASE64=$(base64 -w0 \"$IMG_PATH\")\nfi\n```\n\n### Step 2: Send image with edit prompt (File-Based Approach)\n\n**IMPORTANT:** Always use a file-based approach for the request body. Base64-encoded images are too large for command-line arguments and will cause \"argument list too long\" errors.\n\n```bash\n# User's edit request\nEDIT_PROMPT=\"Add a santa hat to the person in this image\"\n\n# Write request to a JSON file (avoids command line length limits)\ncat > \u002Ftmp\u002Fgemini_request.json \u003C\u003C JSONEOF\n{\n  \"contents\": [{\n    \"parts\": [\n      {\"text\": \"$EDIT_PROMPT\"},\n      {\n        \"inline_data\": {\n          \"mime_type\": \"$MIME_TYPE\",\n          \"data\": \"$IMG_BASE64\"\n        }\n      }\n    ]\n  }],\n  \"generationConfig\": {\n    \"responseModalities\": [\"TEXT\", \"IMAGE\"]\n  }\n}\nJSONEOF\n\n# Call the API using the file\ncurl -s -X POST \\\n  \"https:\u002F\u002Fgenerativelanguage.googleapis.com\u002Fv1beta\u002Fmodels\u002Fgemini-3-pro-image-preview:generateContent\" \\\n  -H \"x-goog-api-key: $GEMINI_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d @\u002Ftmp\u002Fgemini_request.json > \u002Ftmp\u002Fgemini_response.json\n```\n\n### Step 3: Extract and save the edited image\n\n```bash\n# Extract image from response and save\npython3 -c \"\nimport json\nimport base64\n\nwith open('\u002Ftmp\u002Fgemini_response.json') as f:\n    data = json.load(f)\n\nfor part in data['candidates'][0]['content']['parts']:\n    if 'inlineData' in part:\n        img_data = part['inlineData']['data']\n        mime = part['inlineData']['mimeType']\n        ext = 'png' if 'png' in mime else 'jpg'\n        with open('edited_image.' + ext, 'wb') as out:\n            out.write(base64.b64decode(img_data))\n        print(f'Saved: edited_image.{ext}')\n    elif 'text' in part:\n        print(part['text'])\n\"\n```\n\n### Complete Example (File-Based)\n\nFor iterating on images, always use file-based requests:\n\n```bash\n# Variables\nIMG_PATH=\"\u002Fpath\u002Fto\u002Fimage.png\"\nEDIT_PROMPT=\"Make the background a sunset beach\"\nOUTPUT_PATH=\"edited_output.png\"\n# Detect mime type and encode\nMIME_TYPE=$([[ \"$IMG_PATH\" == *.png ]] && echo \"image\u002Fpng\" || echo \"image\u002Fjpeg\")\nIMG_BASE64=$(base64 -i \"$IMG_PATH\" 2>\u002Fdev\u002Fnull || base64 -w0 \"$IMG_PATH\")\n\n# Write request to file (required - base64 images are too large for command line)\ncat > \u002Ftmp\u002Fgemini_request.json \u003C\u003C JSONEOF\n{\n  \"contents\": [{\n    \"parts\": [\n      {\"text\": \"$EDIT_PROMPT\"},\n      {\"inline_data\": {\"mime_type\": \"$MIME_TYPE\", \"data\": \"$IMG_BASE64\"}}\n    ]\n  }],\n  \"generationConfig\": {\n    \"responseModalities\": [\"TEXT\", \"IMAGE\"]\n  }\n}\nJSONEOF\n\n# Call API and extract image\ncurl -s -X POST \\\n  \"https:\u002F\u002Fgenerativelanguage.googleapis.com\u002Fv1beta\u002Fmodels\u002Fgemini-3-pro-image-preview:generateContent\" \\\n  -H \"x-goog-api-key: $GEMINI_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d @\u002Ftmp\u002Fgemini_request.json > \u002Ftmp\u002Fgemini_response.json\n\n# Save the output image\npython3 -c \"\nimport json, base64\nwith open('\u002Ftmp\u002Fgemini_response.json') as f:\n    data = json.load(f)\nfor part in data.get('candidates', [{}])[0].get('content', {}).get('parts', []):\n    if 'inlineData' in part:\n        with open('$OUTPUT_PATH', 'wb') as f:\n            f.write(base64.b64decode(part['inlineData']['data']))\n        print('Saved: $OUTPUT_PATH')\n\"\n```\n\n### Multi-Image Input (Combine\u002FCompose)\n\nTo combine elements from multiple images (also uses file-based approach):\n\n```bash\nIMG1_PATH=\"\u002Fpath\u002Fto\u002Fimage1.png\"\nIMG2_PATH=\"\u002Fpath\u002Fto\u002Fimage2.png\"\nPROMPT=\"Put the dress from the first image on the person in the second image\"\nIMG1_BASE64=$(base64 -i \"$IMG1_PATH\" 2>\u002Fdev\u002Fnull || base64 -w0 \"$IMG1_PATH\")\nIMG2_BASE64=$(base64 -i \"$IMG2_PATH\" 2>\u002Fdev\u002Fnull || base64 -w0 \"$IMG2_PATH\")\n\n# Write request to file\ncat > \u002Ftmp\u002Fgemini_request.json \u003C\u003C JSONEOF\n{\n  \"contents\": [{\n    \"parts\": [\n      {\"text\": \"$PROMPT\"},\n      {\"inline_data\": {\"mime_type\": \"image\u002Fpng\", \"data\": \"$IMG1_BASE64\"}},\n      {\"inline_data\": {\"mime_type\": \"image\u002Fpng\", \"data\": \"$IMG2_BASE64\"}}\n    ]\n  }],\n  \"generationConfig\": {\"responseModalities\": [\"TEXT\", \"IMAGE\"]}\n}\nJSONEOF\n\ncurl -s -X POST \\\n  \"https:\u002F\u002Fgenerativelanguage.googleapis.com\u002Fv1beta\u002Fmodels\u002Fgemini-3-pro-image-preview:generateContent\" \\\n  -H \"x-goog-api-key: $GEMINI_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d @\u002Ftmp\u002Fgemini_request.json > \u002Ftmp\u002Fgemini_response.json\n```\n\n## Capabilities\n\n### Text-to-Image Generation\n- Generate high-quality images from text descriptions\n- Support for photorealistic, stylized, and artistic outputs\n- Accurate text rendering in images (logos, infographics, diagrams)\n\n### Image Editing\n- Add or remove elements from images\n- Inpainting with semantic masking (edit specific parts)\n- Style transfer (apply artistic styles to photos)\n- Multi-image composition (combine elements from multiple images)\n\n### Advanced Features\n- **High Resolution**: 1K, 2K, or 4K output\n- **Aspect Ratios**: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9\n- **Google Search Grounding**: Generate images based on real-time data\n- **Multi-turn Editing**: Iteratively refine images through conversation\n- **Up to 14 Reference Images**: Combine multiple inputs for complex compositions\n\n## API Usage\n\n### Basic Text-to-Image (Python)\n\n```python\nfrom google import genai\nfrom google.genai import types\n\nclient = genai.Client()\n\nresponse = client.models.generate_content(\n    model=\"gemini-3-pro-image-preview\",\n    contents=[\"Your prompt here\"],\n    config=types.GenerateContentConfig(\n        response_modalities=['TEXT', 'IMAGE'],\n        image_config=types.ImageConfig(\n            aspect_ratio=\"16:9\",  # Optional\n            image_size=\"2K\"       # Optional: \"1K\", \"2K\", \"4K\"\n        )\n    )\n)\n\nfor part in response.parts:\n    if part.text is not None:\n        print(part.text)\n    elif part.inline_data is not None:\n        image = part.as_image()\n        image.save(\"generated_image.png\")\n```\n\n### Basic Text-to-Image (JavaScript)\n\n```javascript\nimport { GoogleGenAI } from \"@google\u002Fgenai\";\nimport * as fs from \"node:fs\";\n\nconst ai = new GoogleGenAI({});\n\nconst response = await ai.models.generateContent({\n    model: \"gemini-3-pro-image-preview\",\n    contents: \"Your prompt here\",\n    config: {\n        responseModalities: ['TEXT', 'IMAGE'],\n        imageConfig: {\n            aspectRatio: \"16:9\",\n            imageSize: \"2K\"\n        }\n    }\n});\n\nfor (const part of response.candidates[0].content.parts) {\n    if (part.text) {\n        console.log(part.text);\n    } else if (part.inlineData) {\n        const buffer = Buffer.from(part.inlineData.data, \"base64\");\n        fs.writeFileSync(\"generated_image.png\", buffer);\n    }\n}\n```\n\n### REST API (curl)\n\n```bash\ncurl -s -X POST \\\n  \"https:\u002F\u002Fgenerativelanguage.googleapis.com\u002Fv1beta\u002Fmodels\u002Fgemini-3-pro-image-preview:generateContent\" \\\n  -H \"x-goog-api-key: $GEMINI_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"contents\": [{\n      \"parts\": [{\"text\": \"Your prompt here\"}]\n    }],\n    \"generationConfig\": {\n      \"responseModalities\": [\"TEXT\", \"IMAGE\"],\n      \"imageConfig\": {\n        \"aspectRatio\": \"16:9\",\n        \"imageSize\": \"2K\"\n      }\n    }\n  }' | jq -r '.candidates[0].content.parts[] | select(.inlineData) | .inlineData.data' | base64 --decode > output.png\n```\n\n### Image Editing (with input image)\n\n```python\nfrom google import genai\nfrom google.genai import types\nfrom PIL import Image\n\nclient = genai.Client()\n\ninput_image = Image.open('input.png')\nprompt = \"Add a wizard hat to the cat in this image\"\n\nresponse = client.models.generate_content(\n    model=\"gemini-3-pro-image-preview\",\n    contents=[prompt, input_image],\n    config=types.GenerateContentConfig(\n        response_modalities=['TEXT', 'IMAGE']\n    )\n)\n\nfor part in response.parts:\n    if part.inline_data is not None:\n        image = part.as_image()\n        image.save(\"edited_image.png\")\n```\n\n### Multi-Image Composition\n\n```python\nfrom google import genai\nfrom google.genai import types\nfrom PIL import Image\n\nclient = genai.Client()\n\nimage1 = Image.open('dress.png')\nimage2 = Image.open('model.png')\nprompt = \"Put the dress from the first image on the model from the second image\"\n\nresponse = client.models.generate_content(\n    model=\"gemini-3-pro-image-preview\",\n    contents=[image1, image2, prompt],\n    config=types.GenerateContentConfig(\n        response_modalities=['TEXT', 'IMAGE'],\n        image_config=types.ImageConfig(\n            aspect_ratio=\"3:4\",\n            image_size=\"2K\"\n        )\n    )\n)\n```\n\n### With Google Search Grounding\n\n```python\nfrom google import genai\nfrom google.genai import types\n\nclient = genai.Client()\n\nresponse = client.models.generate_content(\n    model=\"gemini-3-pro-image-preview\",\n    contents=\"Visualize the current weather forecast for San Francisco\",\n    config=types.GenerateContentConfig(\n        response_modalities=['TEXT', 'IMAGE'],\n        image_config=types.ImageConfig(aspect_ratio=\"16:9\"),\n        tools=[{\"google_search\": {}}]\n    )\n)\n```\n\n## Prompting Best Practices\n\n### 1. Be Descriptive, Not Keyword-Based\nInstead of: `cat, wizard hat, cute`\nWrite: `A fluffy orange cat wearing a small knitted wizard hat, sitting on a wooden floor with soft natural lighting from a window`\n\n### 2. Specify Style and Mood\n- Photography terms: \"shot with 85mm lens\", \"soft bokeh background\", \"golden hour lighting\"\n- Artistic styles: \"in the style of Van Gogh\", \"minimalist illustration\", \"photorealistic\"\n- Mood: \"warm and cozy atmosphere\", \"dramatic noir lighting\"\n\n### 3. For Text in Images\nBe explicit about:\n- The exact text to render\n- Font style (descriptively): \"clean, bold, sans-serif font\"\n- Placement and size\n\n### 4. For Editing\n- Describe what to change and what to preserve\n- Use \"keep everything else unchanged\"\n- Reference specific elements clearly\n\n### 5. For Product\u002FCommercial Images\nMention:\n- Lighting setup: \"three-point softbox lighting\"\n- Background: \"clean white studio background\"\n- Camera angle: \"slightly elevated 45-degree shot\"\n\n## Resolution and Aspect Ratio Reference\n\n| Aspect Ratio | 1K Resolution | 2K Resolution | 4K Resolution |\n|--------------|---------------|---------------|---------------|\n| 1:1          | 1024x1024     | 2048x2048     | 4096x4096     |\n| 16:9         | 1376x768      | 2752x1536     | 5504x3072     |\n| 9:16         | 768x1376      | 1536x2752     | 3072x5504     |\n| 3:2          | 1264x848      | 2528x1696     | 5056x3392     |\n| 2:3          | 848x1264      | 1696x2528     | 3392x5056     |\n\n## Common Use Cases\n\n### Logo Creation\n```\nCreate a modern, minimalist logo for a coffee shop called 'The Daily Grind'.\nThe text should be in a clean, bold, sans-serif font.\nBlack and white color scheme. Put the logo in a circle.\n```\n\n### Product Photography\n```\nA high-resolution, studio-lit product photograph of a minimalist ceramic\ncoffee mug in matte black on a polished concrete surface. Three-point\nsoftbox lighting with soft, diffused highlights. Slightly elevated\n45-degree camera angle. Sharp focus on steam rising from the coffee.\n```\n\n### Style Transfer\n```\nTransform this photograph of a city street at night into Vincent van Gogh's\n'Starry Night' style. Preserve the composition but render with swirling,\nimpasto brushstrokes and deep blues with bright yellows.\n```\n\n### Infographic\n```\nCreate a vibrant infographic explaining photosynthesis as a recipe.\nShow \"ingredients\" (sunlight, water, CO2) and \"finished dish\" (sugar\u002Fenergy).\nStyle like a colorful kids' cookbook, suitable for 4th graders.\n```\n\n## Error Handling\n\nCommon issues:\n- **No image returned**: Check that `response_modalities` includes `'IMAGE'`\n- **Safety filters**: Some prompts may be blocked; try rephrasing\n- **Rate limits**: Implement exponential backoff for retries\n- **Large images**: For 4K, ensure sufficient timeout settings\n\n## Dependencies\n\nTo use the Python SDK:\n```bash\npip install google-genai pillow\n```\n\nFor JavaScript:\n```bash\nnpm install @google\u002Fgenai\n```\n\n## Important Notes\n\n- All generated images include a SynthID watermark\n- The model uses a \"thinking\" process for complex prompts\n- For best text rendering, generate text first, then request image with that text\n- Images are not stored by the API - save outputs locally\n\n\n## Limitations\n\n- Requires the upstream tool, account, API key, or local setup when the workflow names one.\n- Does not authorize destructive, production, paid, or external-message actions without explicit user approval.\n- Validate generated artifacts or recommendations against the user's real sources before treating them as final.\n",{"name":5,"risk":24,"tags":25,"tools":29,"author":33,"source":34,"license":15,"category":35,"date_added":36,"description":7,"source_repo":37,"source_type":34,"allowed-tools":38,"license_source":39},"safe",[26,27,28],"dair-academy","ai","workflow",[30,31,32],"claude-code","codex-cli","cursor","DAIR.AI","official","media","2026-06-19","dair-ai\u002Fdair-academy-plugins","Read, Write, Bash, WebFetch","https:\u002F\u002Fgithub.com\u002Fdair-ai\u002Fdair-academy-plugins\u002Fblob\u002Fmain\u002FREADME.md#license","main","a4404a75dc81d6b7e58c5906b6aaffbcb5e84747","Claude\u002Fantigravity skills\u002Fagentic-awesome-skills\u002Fskills\u002Fimage-generator",0,"https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills","https:\u002F\u002Fgithub.com\u002FMHassan0000","https:\u002F\u002Fhassanyousaf.vercel.app","Full Stack Developer building web apps, SaaS, AI systems, and automations. Passionate about clean code, UI\u002FUX, backend systems, and turning ideas into products.","2026-08-07 20:42:05",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":61},[51,54,57],{"tool":52,"command":53},"npx","npx skills add MHassan0000\u002FSkills --skill image-generator",{"tool":55,"command":56},"bunx","bunx skills add MHassan0000\u002FSkills --skill image-generator",{"tool":58,"command":59},"pnpm","pnpm dlx skills add MHassan0000\u002FSkills --skill image-generator","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fantigravity skills\u002Fagentic-awesome-skills\u002Fskills\u002Fimage-generator\u002FSKILL.md",true,[63],{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},".env.example","OTHER","其他",255,"https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fantigravity skills\u002Fagentic-awesome-skills\u002Fskills\u002Fimage-generator\u002F.env.example",[70,77,84,91,100,108],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7AGBX58S04DX8DKKME8N311","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fskills boraztunc github\u002Fvercel-react-best-practices\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7AGBREE890608Z7YDMAKH27","stop-slop","Remove AI writing patterns from prose. Use when drafting, editing, or reviewing text to eliminate predictable AI tells and produce more human-like writing.","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fskills boraztunc github\u002Fstop-slop\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7AGAS972A2AN7Q5EW8HEAXK","ogilvy-copywriting","Apply David Ogilvy's advertising principles when writing or reviewing copy, headlines, product descriptions, landing pages, ads, emails, or any persuasive text. Use when the goal is copy that sells, not copy that wins awards. Covers positioning, headlines, promises, brand voice, long-form copy, and visual logic. Source: How to Create Advertising That Sells (1972) + Ogilvy on Advertising.","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fskills boraztunc github\u002Fogilvy\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":95,"licenseFileUrl":96,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M7AGAF12803G5JPVMK79AYJB","frontend-design","Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML\u002FCSS layouts, or when styling\u002Fbeautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fskills boraztunc github\u002Ffrontend-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fskills boraztunc github\u002Ffrontend-design\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":95,"licenseFileUrl":104,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":19},"01M7AG88WWVWCGJY9WA9CH7EY4","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fobra superpower skills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fobra superpower skills\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":95,"licenseFileUrl":112,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":19},"01M7AG7ZTNV7XQCWDQ9674FBYB","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fobra superpower skills\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fobra superpower skills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[]]