image-generator – skill Thiết kế & UI cho agent AI
Tạo và chỉnh sửa hình ảnh bằng mô hình Nano Banana Pro của Gemini (gemini-3-pro-image-preview). Dùng kỹ năng này khi người dùng yêu cầu tạo hình ảnh, tạo visual, chỉnh sửa ảnh, tạo logo, tạo mockup sản phẩm hoặc bất kỳ tác vụ tạo/chỉnh sửa hình ảnh nào.
Cài skill image-generator bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/image-generator-2e4fa.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /image-generator – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/image-generator-2e4fa.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $image-generator – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/image-generator-2e4fa.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /image-generator – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/image-generator-2e4fa.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /image-generator – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Image Generator
Detailed Guide
Read [the detailed guide](references/detailed-guide.md) before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.
When to Use
Use 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/editing task.
_Source: [dair-ai/dair-academy-plugins](https://github.com/dair-ai/dair-academy-plugins) (MIT)._
This skill generates and edits images using Google's Gemini Nano Banana Pro model (gemini-3-pro-image-preview).
API Usage
Paid external API workflow: confirm approved model/budget, exact prompt and input image set, rights/consent and provider data policy before requests. Model ID/options below are historical examples; check current availability and SDK version. Never promise exact text, masking or resolution; inspect returned MIME/dimensions and visible output. Preserve originals and use new unique output names, writing only within the authorized destination. A missing/blocked image is not success; do not retry billable calls blindly after uncertain outcomes.
Basic Text-to-Image (Python)
from google import genai
from google.genai import types
client = genai.Client()
response = client.models.generate_content(
model="gemini-3-pro-image-preview",
contents=["Your prompt here"],
config=types.GenerateContentConfig(
response_modalities=['TEXT', 'IMAGE'],
image_config=types.ImageConfig(
aspect_ratio="16:9", # Optional
image_size="2K" # Optional: "1K", "2K", "4K"
)
)
)
for part in response.parts:
if part.text is not None:
print(part.text)
elif part.inline_data is not None:
image = part.as_image()
image.save("generated_image.png")Basic Text-to-Image (JavaScript)
import { GoogleGenAI } from "@google/genai";
import * as fs from "node:fs";
const ai = new GoogleGenAI({});
const response = await ai.models.generateContent({
model: "gemini-3-pro-image-preview",
contents: "Your prompt here",
config: {
responseModalities: ['TEXT', 'IMAGE'],
imageConfig: {
aspectRatio: "16:9",
imageSize: "2K"
}
}
});
for (const part of response.candidates[0].content.parts) {
if (part.text) {
console.log(part.text);
} else if (part.inlineData) {
const buffer = Buffer.from(part.inlineData.data, "base64");
fs.writeFileSync("generated_image.png", buffer);
}
}REST alternative
Prefer the SDK examples so credentials are not interpolated into command-line headers and JSON is serialized correctly. If implementing REST, use a protected header/request file, explicit timeouts and HTTP-status handling; validate candidate/part/MIME fields before writing bytes. Do not assume the first candidate or an image exists.
Image Editing (with input image)
from google import genai
from google.genai import types
from PIL import Image
client = genai.Client()
input_image = Image.open('input.png')
prompt = "Add a wizard hat to the cat in this image"
response = client.models.generate_content(
model="gemini-3-pro-image-preview",
contents=[prompt, input_image],
config=types.GenerateContentConfig(
response_modalities=['TEXT', 'IMAGE']
)
)
for part in response.parts:
if part.inline_data is not None:
image = part.as_image()
image.save("edited_image.png")Multi-Image Composition
from google import genai
from google.genai import types
from PIL import Image
client = genai.Client()
image1 = Image.open('dress.png')
image2 = Image.open('model.png')
prompt = "Put the dress from the first image on the model from the second image"
response = client.models.generate_content(
model="gemini-3-pro-image-preview",
contents=[image1, image2, prompt],
config=types.GenerateContentConfig(
response_modalities=['TEXT', 'IMAGE'],
image_config=types.ImageConfig(
aspect_ratio="3:4",
image_size="2K"
)
)
)With Google Search Grounding
from google import genai
from google.genai import types
client = genai.Client()
response = client.models.generate_content(
model="gemini-3-pro-image-preview",
contents="Visualize the current weather forecast for San Francisco",
config=types.GenerateContentConfig(
response_modalities=['TEXT', 'IMAGE'],
image_config=types.ImageConfig(aspect_ratio="16:9"),
tools=[{"google_search": {}}]
)
)Limitations
- Requires the upstream tool, account, API key, or local setup when the workflow names one.
- Does not authorize destructive, production, paid, or external-message actions without explicit user approval.
- Validate generated artifacts or recommendations against the user's real sources before treating them as final.
Skill liên quan
- image-studio – Studio tạo hình ảnh thông minh: tự động định tuyến giữa ai-studio-image (ảnh người…
- imagen – Kỹ năng tạo hình ảnh bằng AI do Google Gemini cung cấp, hỗ trợ tạo nội dung hình ảnh…
- industrial-brutalist-ui – Dùng khi tạo giao diện telemetry công nghiệp hoặc chiến thuật thô, với lưới cứng…
- isometric-design – Hướng dẫn triển khai Isometric Design cho web và ứng dụng. Kích hoạt khi người dùng muốn…
- json-canvas – Tạo và chỉnh sửa file JSON Canvas (.canvas) với node, cạnh, nhóm và kết nối. Dùng khi…
- ui-design-system – Bộ công cụ hệ thống thiết kế UI dành cho Senior UI Designer, gồm tạo design token, tài…
- ux-researcher-designer – Bộ công cụ nghiên cứu và thiết kế UX cho Senior UX Designer/Researcher, gồm tạo persona…
- kpi-dashboard-design – Các mẫu toàn diện để thiết kế dashboard KPI (Key Performance Indicator) hiệu quả, hỗ trợ…