Nano Banana는 Gemini의 기본 이미지 생성 기능의 이름입니다. 현재 Gemini API에서 사용할 수 있는 두 가지 모델을 의미합니다.
- Nano Banana: Gemini 2.5 Flash Image 모델 (
gemini-2.5-flash-image). 이 모델은 속도와 효율성을 위해 설계되었으며 대용량, 짧은 지연 시간 작업에 최적화되어 있습니다. - Nano Banana Pro: Gemini 3 Pro Image 미리보기 모델 (
gemini-3-pro-image-preview). 이 모델은 전문적인 애셋 제작을 위해 설계되었으며, 고급 추론 ('사고')을 활용하여 복잡한 안내를 따르고 충실도 높은 텍스트를 렌더링합니다.
시작하기
사용하려는 버전에 해당하는 모델 이름을 사용하여 generate_content 메서드를 통해 이미지를 생성할 수 있습니다.
Python
from google import genai
from PIL import Image
client = genai.Client()
response = client.models.generate_content(
model="gemini-2.5-flash-image",
contents="Create a picture of a futuristic banana with neon lights in a cyberpunk city.",
)
for part in response.parts:
if part.inline_data:
image = part.as_image()
image.show()
자바스크립트
import { GoogleGenAI } from "@google/genai";
import * as fs from "node:fs";
const ai = new GoogleGenAI({});
const response = await ai.models.generateContent({
model: "gemini-2.5-flash-image",
contents: "Create a picture of a futuristic banana with neon lights in a cyberpunk city.",
});
for (const part of response.candidates[0].content.parts) {
if (part.inlineData) {
const buffer = Buffer.from(part.inlineData.data, "base64");
fs.writeFileSync("banana.png", buffer);
}
}
Go
package main
import (
"context"
"os"
"google.golang.org/genai"
)
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, nil)
if err != nil {
// handle error
}
resp, err := client.Models.GenerateContent(
ctx,
"gemini-2.5-flash-image",
genai.Text("Create a picture of a futuristic banana with neon lights in a cyberpunk city."),
)
for _, part := range resp.Candidates[0].Content.Parts {
if part.InlineData != nil {
_ = os.WriteFile("banana.png", part.InlineData.Data, 0644)
}
}
}
자바
import com.google.genai.Client;
import com.google.genai.types.GenerateContentResponse;
import com.google.genai.types.Part;
import java.nio.file.Files;
import java.nio.file.Paths;
public class ImageGen {
public static void main(String[] args) throws Exception {
try (Client client = new Client()) {
GenerateContentResponse response = client.models.generateContent(
"gemini-2.5-flash-image",
"Create a picture of a futuristic banana with neon lights in a cyberpunk city.",
null);
for (Part part : response.parts()) {
if (part.inlineData().isPresent()) {
Files.write(Paths.get("banana.png"), part.inlineData().get().data().get());
}
}
}
}
}
REST
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"contents": [{
"parts": [
{"text": "Create a picture of a futuristic banana with neon lights in a cyberpunk city."}
]
}]
}'
자세히 알아보기
이미지 생성, 편집, 고급 프롬프트, 모델 비교에 관한 포괄적인 문서는 다음 전체 가이드를 참고하세요.
- Gemini를 사용한 이미지 생성: Nano Banana 및 Nano Banana Pro 모델 사용에 관한 전체 가이드
- 모델 정보: 모델 버전, 기능, 가격에 관한 세부정보입니다.