Nano Banana, Gemini में इमेज जनरेट करने की सुविधा का नाम है. फ़िलहाल, यह Gemini API में उपलब्ध दो अलग-अलग मॉडल के बारे में बताता है:
- Nano Banana: यह Gemini 2.5 Flash Image मॉडल (
gemini-2.5-flash-image) है. इस मॉडल को तेज़ी से और बेहतर तरीके से काम करने के लिए डिज़ाइन किया गया है. इसे ऐसे टास्क के लिए ऑप्टिमाइज़ किया गया है जिनमें ज़्यादा डेटा की ज़रूरत होती है और जिन्हें रीयल-टाइम में पूरा करने की ज़रूरत नहीं होती. - Nano Banana Pro: यह Gemini 3 Pro Image Preview मॉडल (
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()
JavaScript
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);
}
}
ऐप पर जाएं
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)
}
}
}
Java
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 मॉडल इस्तेमाल करने के बारे में पूरी जानकारी.
- मॉडल के बारे में जानकारी: मॉडल के वर्शन, क्षमताओं, और कीमत के बारे में जानकारी.