ন্যানো কলার ছবি তৈরি

এক লাইন কোড লেখার আগেই, সম্পূর্ণ কার্যকরী ও ইউজার ইন্টারফেস-সমন্বিত অ্যাপের প্রোটোটাইপ তৈরি করার জন্য নির্দেশনা পান এবং বাস্তব জগতের টুলস, ডেটা ও জেমিনি ইকোসিস্টেমের সাথে ন্যানো ব্যানানা ২-এর ইন্টিগ্রেশন দেখুন।
  • ন্যানো বানানা ২ অ্যাপটি ব্যবহার করে দেখুন
  • অথবা নির্দেশিকা থেকে নিজের মতো করে তৈরি করুন:
    • ম্যাগাজিনলন্ডনপুনরুদ্ধার করুনকলাক্যাফেপ্রবন্ধকুকুরআইসোমেট্রিক
    • ম্যাগাজিন
      ন্যানো বানানা ২ দ্বারা তৈরি
      নির্দেশনা: "একটি চকচকে ম্যাগাজিনের প্রচ্ছদের ছবি। সাদামাটা নীল প্রচ্ছদটিতে বড় ও মোটা অক্ষরে ‘ন্যানো ব্যানানা’ লেখা রয়েছে। লেখাটি সেরিফ ফন্টে লেখা এবং পুরো প্রচ্ছদ জুড়ে রয়েছে। অন্য কোনো লেখা নেই। লেখাটির সামনে একটি মার্জিত ও সাদামাটা পোশাক পরা এক ব্যক্তির প্রতিকৃতি রয়েছে। তিনি খেলাচ্ছলে ২ সংখ্যাটি ধরে আছেন, যা ছবির মূল আকর্ষণ।"
      কোণায় বারকোডসহ সংখ্যা নম্বর এবং "ফেব্রুয়ারি ২০২৬" তারিখটি রাখুন। ম্যাগাজিনটি একটি ডিজাইনার স্টোরের ভেতরে, কমলা রঙের প্লাস্টার করা দেয়াল ঘেঁষে একটি তাকে রাখা আছে।
    • লন্ডন
      ন্যানো বানানা প্রো দ্বারা তৈরি
      নির্দেশনা: "লন্ডনের একটি স্পষ্ট, ৪৫° টপ-ডাউন আইসোমেট্রিক ক্ষুদ্রাকৃতির ৩ডি কার্টুন দৃশ্য উপস্থাপন করুন, যেখানে এর সবচেয়ে বিখ্যাত ল্যান্ডমার্ক এবং স্থাপত্য উপাদানগুলো থাকবে। বাস্তবসম্মত PBR ম্যাটেরিয়ালসহ নরম, পরিমার্জিত টেক্সচার এবং মৃদু, জীবন্ত আলো ও ছায়া ব্যবহার করুন। একটি নিমগ্নকারী আবহ তৈরি করতে বর্তমান আবহাওয়ার পরিস্থিতি সরাসরি শহরের পরিবেশে অন্তর্ভুক্ত করুন। একটি নরম, একরঙা পটভূমিসহ পরিচ্ছন্ন ও ন্যূনতম কম্পোজিশন ব্যবহার করুন। উপরের কেন্দ্রে, বড় ও মোটা অক্ষরে "লন্ডন" শিরোনামটি রাখুন, তার নিচে একটি সুস্পষ্ট আবহাওয়ার আইকন, তারপর তারিখ (ছোট অক্ষরে) এবং তাপমাত্রা (মাঝারি অক্ষরে) দিন। সমস্ত লেখা অবশ্যই সামঞ্জস্যপূর্ণ ব্যবধানসহ কেন্দ্রে থাকতে হবে এবং তা ভবনগুলোর চূড়ার ওপর সামান্যভাবে ছড়িয়ে থাকতে পারে।"
      সার্চ গ্রাউন্ডিং সম্পর্কে আরও জানুন এবং এআই স্টুডিওতে এটি ব্যবহার করে দেখুন।
    • কোয়েটজাল
      ন্যানো বানানা ২ দ্বারা তৈরি
      নির্দেশনা: "ইমেজ সার্চ ব্যবহার করে একটি রেসপ্লেন্ডেন্ট কোয়েটজাল পাখির সঠিক ছবি খুঁজুন। এই পাখিটির একটি সুন্দর ৩:২ ওয়ালপেপার তৈরি করুন, যেখানে উপর থেকে নিচে একটি স্বাভাবিক গ্রেডিয়েন্ট এবং ন্যূনতম কম্পোজিশন থাকবে।"
      ন্যানো ব্যানানা ২-এর সাথে গুগল ইমেজ সার্চ গ্রাউন্ডিং ব্যবহার করুন। এআই স্টুডিওতে এটি চেষ্টা করে দেখুন।
    • কলা
      ন্যানো বানানা প্রো দ্বারা তৈরি
      নির্দেশনা: "কলার সুগন্ধযুক্ত একটি পারফিউমের উচ্চমানের বিজ্ঞাপনে এই লোগোটি ব্যবহার করুন। লোগোটি বোতলের সাথে নিখুঁতভাবে মিশে গেছে।"
      AI Studio- তে Nano Banana-র উচ্চ মানের ডিটেইল সংরক্ষণের সুবিধাটি ব্যবহার করে দেখুন।
    • ক্যাফে
      ন্যানো বানানা প্রো দ্বারা তৈরি
      নির্দেশনা: "সকালের নাস্তা পরিবেশন করা হচ্ছে এমন একটি ব্যস্ত ক্যাফের দৈনন্দিন দৃশ্যের ছবি। সামনের দিকে নীল চুলের একজন অ্যানিমে পুরুষ, মানুষগুলোর মধ্যে একজন পেন্সিল স্কেচ এবং অন্যজন একটি ক্লেমেশন চরিত্র।"
      এআই স্টুডিওতে ন্যানো ব্যানানা দিয়ে বিভিন্ন শৈলী নিয়ে পরীক্ষা-নিরীক্ষা করুন
    • প্রবন্ধ
      ন্যানো বানানা প্রো দ্বারা তৈরি
      নির্দেশনা: "জেমিনি ৩ ফ্ল্যাশ-এর ​​উন্মোচন কেমন সাড়া পেয়েছে তা জানতে সার্চ ব্যবহার করুন। এই তথ্য ব্যবহার করে এ বিষয়ে একটি সংক্ষিপ্ত প্রবন্ধ (শিরোনামসহ) লিখুন। ডিজাইন-কেন্দ্রিক কোনো গ্লসি ম্যাগাজিনে প্রকাশিত প্রবন্ধটির একটি ছবি ফেরত দিন। এটি জেমিনি ৩ ফ্ল্যাশ সম্পর্কিত প্রবন্ধটি দেখানো একটিমাত্র ভাঁজ করা পাতার ছবি। একটি প্রধান ছবি থাকবে। শিরোনামটি সেরিফ ফন্টে হবে।"
      সার্চ থেকে নির্ভুল টেক্সট তৈরি করুন। এআই স্টুডিওতে ন্যানো ব্যানানা ব্যবহার করে দেখুন।
    • কুকুর
      ন্যানো বানানা প্রো দ্বারা তৈরি
      নির্দেশনা: "একটি সুন্দর কুকুরের আইকন। পটভূমি সাদা। আইকনগুলো রঙিন এবং স্পর্শযোগ্য ত্রিমাত্রিক (3D) শৈলীতে তৈরি করুন। কোনো লেখা থাকবে না।"
      AI Studio- তে Nano Banana ব্যবহার করে আইকন, স্টিকার এবং অ্যাসেট তৈরি করুন।
    • আইসোমেট্রিক
      ন্যানো বানানা ২ দ্বারা তৈরি
      নির্দেশনা: "একটি নিখুঁত আইসোমেট্রিক ছবি তৈরি করুন। এটি কোনো ক্ষুদ্রাকৃতি ছবি নয়, বরং এমন একটি তোলা ছবি যা ঘটনাক্রমে নিখুঁত আইসোমেট্রিক হয়েছে। এটি একটি সুন্দর আধুনিক বাগানের ছবি। এতে একটি বড় ২ আকৃতির পুল এবং ‘ন্যানো ব্যানানা ২’ লেখাটি রয়েছে।"

    ন্যানো ব্যানানা হলো জেমিনির নিজস্ব ইমেজ তৈরির ক্ষমতার নাম। জেমিনি টেক্সট, ছবি বা উভয়ের সংমিশ্রণ ব্যবহার করে কথোপকথনের মতো করে ছবি তৈরি ও প্রসেস করতে পারে। এর ফলে আপনি অভূতপূর্ব নিয়ন্ত্রণের সাথে ভিজ্যুয়াল তৈরি, সম্পাদনা এবং তাতে বারবার পরিবর্তন আনতে পারেন।

    ন্যানো ব্যানানা বলতে জেমিনি এপিআই-তে উপলব্ধ তিনটি স্বতন্ত্র মডেলকে বোঝায়:

    • ন্যানো ব্যানানা ২ : জেমিনি ৩.১ ফ্ল্যাশ ইমেজ প্রিভিউ মডেল ( gemini-3.1-flash-image-preview )। এই মডেলটি জেমিনি ৩ প্রো ইমেজ-এর উচ্চ-দক্ষতাসম্পন্ন সংস্করণ হিসেবে কাজ করে, যা গতি এবং অধিক পরিমাণে ডেভেলপার ব্যবহারের জন্য বিশেষভাবে তৈরি।
    • ন্যানো ব্যানানা প্রো : জেমিনি ৩ প্রো ইমেজ প্রিভিউ মডেল ( gemini-3-pro-image-preview )। এই মডেলটি পেশাদার অ্যাসেট তৈরির জন্য ডিজাইন করা হয়েছে, যা জটিল নির্দেশাবলী অনুসরণ করতে এবং উচ্চ-মানের টেক্সট রেন্ডার করতে উন্নত যুক্তি ("চিন্তা") ব্যবহার করে।
    • ন্যানো ব্যানানা : জেমিনি ২.৫ ফ্ল্যাশ ইমেজ মডেল ( gemini-2.5-flash-image )। এই মডেলটি গতি এবং দক্ষতার জন্য ডিজাইন করা হয়েছে এবং এটি উচ্চ-পরিমাণ ও স্বল্প-বিলম্বের কাজগুলোর জন্য অপ্টিমাইজ করা হয়েছে।

    জেনারেট করা সমস্ত ছবিতে একটি SynthID ওয়াটারমার্ক অন্তর্ভুক্ত থাকে।

    ছবি তৈরি (টেক্সট থেকে ছবি)

    পাইথন

    from google import genai
    from google.genai import types
    from PIL import Image
    
    client = genai.Client()
    
    prompt = ("Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme")
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[prompt],
    )
    
    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")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const prompt =
        "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme";
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("gemini-native-image.png", buffer);
          console.log("Image saved as gemini-native-image.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
      "context"
      "fmt"
      "log"
      "os"
      "google.golang.org/genai"
    )
    
    func main() {
    
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
    
      result, _ := client.Models.GenerateContent(
          ctx,
          "gemini-3.1-flash-image-preview",
          genai.Text("Create a picture of a nano banana dish in a " +
                     " fancy restaurant with a Gemini theme"),
      )
    
      for _, part := range result.Candidates[0].Content.Parts {
          if part.Text != "" {
              fmt.Println(part.Text)
          } else if part.InlineData != nil {
              imageBytes := part.InlineData.Data
              outputFilename := "gemini_generated_image.png"
              _ = os.WriteFile(outputFilename, imageBytes, 0644)
          }
      }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class TextToImage {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme",
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("_01_generated_image.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{
          "parts": [
            {"text": "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme"}
          ]
        }]
      }'
    

    ছবি সম্পাদনা (টেক্সট ও ছবি থেকে ছবিতে)

    অনুস্মারক : আপনি যে কোনো ছবি আপলোড করছেন, তার জন্য আপনার প্রয়োজনীয় অধিকার আছে কিনা তা নিশ্চিত করুন। এমন কোনো কন্টেন্ট তৈরি করবেন না যা অন্যের অধিকার লঙ্ঘন করে, যার মধ্যে প্রতারণা, হয়রানি বা ক্ষতিসাধনকারী ভিডিও বা ছবি অন্তর্ভুক্ত। এই জেনারেটিভ এআই পরিষেবাটির আপনার ব্যবহার আমাদের নিষিদ্ধ ব্যবহার নীতির অধীন।

    একটি ছবি দিন এবং টেক্সট প্রম্পট ব্যবহার করে উপাদান যোগ, অপসারণ বা পরিবর্তন করুন, স্টাইল বদলান, অথবা কালার গ্রেডিং অ্যাডজাস্ট করুন।

    নিম্নলিখিত উদাহরণটি base64 এনকোডেড ছবি আপলোড করার পদ্ধতি প্রদর্শন করে। একাধিক ছবি, বৃহত্তর পেলোড এবং সমর্থিত MIME প্রকারের জন্য, 'ছবি বোঝা' পৃষ্ঠাটি দেখুন।

    পাইথন

    from google import genai
    from google.genai import types
    from PIL import Image
    
    client = genai.Client()
    
    prompt = (
        "Create a picture of my cat eating a nano-banana in a "
        "fancy restaurant under the Gemini constellation",
    )
    
    image = Image.open("/path/to/cat_image.png")
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[prompt, image],
    )
    
    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")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const imagePath = "path/to/cat_image.png";
      const imageData = fs.readFileSync(imagePath);
      const base64Image = imageData.toString("base64");
    
      const prompt = [
        { text: "Create a picture of my cat eating a nano-banana in a" +
                "fancy restaurant under the Gemini constellation" },
        {
          inlineData: {
            mimeType: "image/png",
            data: base64Image,
          },
        },
      ];
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("gemini-native-image.png", buffer);
          console.log("Image saved as gemini-native-image.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
     "context"
     "fmt"
     "log"
     "os"
     "google.golang.org/genai"
    )
    
    func main() {
    
     ctx := context.Background()
     client, err := genai.NewClient(ctx, nil)
     if err != nil {
         log.Fatal(err)
     }
    
     imagePath := "/path/to/cat_image.png"
     imgData, _ := os.ReadFile(imagePath)
    
     parts := []*genai.Part{
       genai.NewPartFromText("Create a picture of my cat eating a nano-banana in a fancy restaurant under the Gemini constellation"),
       &genai.Part{
         InlineData: &genai.Blob{
           MIMEType: "image/png",
           Data:     imgData,
         },
       },
     }
    
     contents := []*genai.Content{
       genai.NewContentFromParts(parts, genai.RoleUser),
     }
    
     result, _ := client.Models.GenerateContent(
         ctx,
         "gemini-3.1-flash-image-preview",
         contents,
     )
    
     for _, part := range result.Candidates[0].Content.Parts {
         if part.Text != "" {
             fmt.Println(part.Text)
         } else if part.InlineData != nil {
             imageBytes := part.InlineData.Data
             outputFilename := "gemini_generated_image.png"
             _ = os.WriteFile(outputFilename, imageBytes, 0644)
         }
     }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.Content;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    
    public class TextAndImageToImage {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              Content.fromParts(
                  Part.fromText("""
                      Create a picture of my cat eating a nano-banana in
                      a fancy restaurant under the Gemini constellation
                      """),
                  Part.fromBytes(
                      Files.readAllBytes(
                          Path.of("src/main/resources/cat.jpg")),
                      "image/jpeg")),
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("gemini_generated_image.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
        -H "x-goog-api-key: $GEMINI_API_KEY" \
        -H 'Content-Type: application/json' \
        -d "{
          \"contents\": [{
            \"parts\":[
                {\"text\": \"'Create a picture of my cat eating a nano-banana in a fancy restaurant under the Gemini constellation\"},
                {
                  \"inline_data\": {
                    \"mime_type\":\"image/jpeg\",
                    \"data\": \"<BASE64_IMAGE_DATA>\"
                  }
                }
            ]
          }]
        }"
    

    মাল্টি-টার্ন ইমেজ এডিটিং

    কথোপকথনের ভঙ্গিতে ছবি তৈরি ও সম্পাদনা করতে থাকুন। ছবি নিয়ে কাজ করার জন্য চ্যাট বা একাধিক পালার আলোচনা সবচেয়ে ভালো উপায়। নিচের উদাহরণটিতে সালোকসংশ্লেষণ বিষয়ে একটি ইনফোগ্রাফিক তৈরির নির্দেশ দেখানো হয়েছে।

    পাইথন

    from google import genai
    from google.genai import types
    
    client = genai.Client()
    
    chat = client.chats.create(
        model="gemini-3.1-flash-image-preview",
        config=types.GenerateContentConfig(
            response_modalities=['TEXT', 'IMAGE'],
            tools=[{"google_search": {}}]
        )
    )
    
    message = "Create a vibrant infographic that explains photosynthesis as if it were a recipe for a plant's favorite food. Show the \"ingredients\" (sunlight, water, CO2) and the \"finished dish\" (sugar/energy). The style should be like a page from a colorful kids' cookbook, suitable for a 4th grader."
    
    response = chat.send_message(message)
    
    for part in response.parts:
        if part.text is not None:
            print(part.text)
        elif image:= part.as_image():
            image.save("photosynthesis.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    
    const ai = new GoogleGenAI({});
    
    async function main() {
      const chat = ai.chats.create({
        model: "gemini-3.1-flash-image-preview",
        config: {
          responseModalities: ['TEXT', 'IMAGE'],
          tools: [{googleSearch: {}}],
        },
      });
    }
    
    await main();
    
    const message = "Create a vibrant infographic that explains photosynthesis as if it were a recipe for a plant's favorite food. Show the \"ingredients\" (sunlight, water, CO2) and the \"finished dish\" (sugar/energy). The style should be like a page from a colorful kids' cookbook, suitable for a 4th grader."
    
    let response = await chat.sendMessage({message});
    
    for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("photosynthesis.png", buffer);
          console.log("Image saved as photosynthesis.png");
        }
    }
    

    যান

    package main
    
    import (
        "context"
        "fmt"
        "log"
        "os"
    
        "google.golang.org/genai"
    )
    
    func main() {
        ctx := context.Background()
        client, err := genai.NewClient(ctx, nil)
        if err != nil {
            log.Fatal(err)
        }
        defer client.Close()
    
        model := client.GenerativeModel("gemini-3.1-flash-image-preview")
        model.GenerationConfig = &pb.GenerationConfig{
            ResponseModalities: []pb.ResponseModality{genai.Text, genai.Image},
        }
        chat := model.StartChat()
    
        message := "Create a vibrant infographic that explains photosynthesis as if it were a recipe for a plant's favorite food. Show the \"ingredients\" (sunlight, water, CO2) and the \"finished dish\" (sugar/energy). The style should be like a page from a colorful kids' cookbook, suitable for a 4th grader."
    
        resp, err := chat.SendMessage(ctx, genai.Text(message))
        if err != nil {
            log.Fatal(err)
        }
    
        for _, part := range resp.Candidates[0].Content.Parts {
            if txt, ok := part.(genai.Text); ok {
                fmt.Printf("%s", string(txt))
            } else if img, ok := part.(genai.ImageData); ok {
                err := os.WriteFile("photosynthesis.png", img.Data, 0644)
                if err != nil {
                    log.Fatal(err)
                }
            }
        }
    }
    

    জাভা

    import com.google.genai.Chat;
    import com.google.genai.Client;
    import com.google.genai.types.Content;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.GoogleSearch;
    import com.google.genai.types.ImageConfig;
    import com.google.genai.types.Part;
    import com.google.genai.types.RetrievalConfig;
    import com.google.genai.types.Tool;
    import com.google.genai.types.ToolConfig;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    
    public class MultiturnImageEditing {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
    
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .tools(Tool.builder()
                  .googleSearch(GoogleSearch.builder().build())
                  .build())
              .build();
    
          Chat chat = client.chats.create("gemini-3.1-flash-image-preview", config);
    
          GenerateContentResponse response = chat.sendMessage("""
              Create a vibrant infographic that explains photosynthesis
              as if it were a recipe for a plant's favorite food.
              Show the "ingredients" (sunlight, water, CO2)
              and the "finished dish" (sugar/energy).
              The style should be like a page from a colorful
              kids' cookbook, suitable for a 4th grader.
              """);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("photosynthesis.png"), blob.data().get());
              }
            }
          }
          // ...
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{
          "role": "user",
          "parts": [
            {"text": "Create a vibrant infographic that explains photosynthesis as if it were a recipe for a plants favorite food. Show the \"ingredients\" (sunlight, water, CO2) and the \"finished dish\" (sugar/energy). The style should be like a page from a colorful kids cookbook, suitable for a 4th grader."}
          ]
        }],
        "generationConfig": {
          "responseModalities": ["TEXT", "IMAGE"]
        }
      }'
    
    সালোকসংশ্লেষণ সম্পর্কে এআই-নির্মিত ইনফোগ্রাফিক
    সালোকসংশ্লেষণ সম্পর্কে এআই-নির্মিত ইনফোগ্রাফিক

    এরপর আপনি একই চ্যাট ব্যবহার করে গ্রাফিকের ভাষা স্প্যানিশে পরিবর্তন করতে পারবেন।

    পাইথন

    message = "Update this infographic to be in Spanish. Do not change any other elements of the image."
    aspect_ratio = "16:9" # "1:1","1:4","1:8","2:3","3:2","3:4","4:1","4:3","4:5","5:4","8:1","9:16","16:9","21:9"
    resolution = "2K" # "512", "1K", "2K", "4K"
    
    response = chat.send_message(message,
        config=types.GenerateContentConfig(
            image_config=types.ImageConfig(
                aspect_ratio=aspect_ratio,
                image_size=resolution
            ),
        ))
    
    for part in response.parts:
        if part.text is not None:
            print(part.text)
        elif image:= part.as_image():
            image.save("photosynthesis_spanish.png")
    

    জাভাস্ক্রিপ্ট

    const message = 'Update this infographic to be in Spanish. Do not change any other elements of the image.';
    const aspectRatio = '16:9';
    const resolution = '2K';
    
    let response = await chat.sendMessage({
      message,
      config: {
        responseModalities: ['TEXT', 'IMAGE'],
        imageConfig: {
          aspectRatio: aspectRatio,
          imageSize: resolution,
        },
        tools: [{googleSearch: {}}],
      },
    });
    
    for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("photosynthesis2.png", buffer);
          console.log("Image saved as photosynthesis2.png");
        }
    }
    

    যান

    message = "Update this infographic to be in Spanish. Do not change any other elements of the image."
    aspect_ratio = "16:9" // "1:1","1:4","1:8","2:3","3:2","3:4","4:1","4:3","4:5","5:4","8:1","9:16","16:9","21:9"
    resolution = "2K"     // "512", "1K", "2K", "4K"
    
    model.GenerationConfig.ImageConfig = &pb.ImageConfig{
        AspectRatio: aspect_ratio,
        ImageSize:   resolution,
    }
    
    resp, err = chat.SendMessage(ctx, genai.Text(message))
    if err != nil {
        log.Fatal(err)
    }
    
    for _, part := range resp.Candidates[0].Content.Parts {
        if txt, ok := part.(genai.Text); ok {
            fmt.Printf("%s", string(txt))
        } else if img, ok := part.(genai.ImageData); ok {
            err := os.WriteFile("photosynthesis_spanish.png", img.Data, 0644)
            if err != nil {
                log.Fatal(err)
            }
        }
    }
    

    জাভা

    String aspectRatio = "16:9"; // "1:1","1:4","1:8","2:3","3:2","3:4","4:1","4:3","4:5","5:4","8:1","9:16","16:9","21:9"
    String resolution = "2K"; // "512", "1K", "2K", "4K"
    
    config = GenerateContentConfig.builder()
        .responseModalities("TEXT", "IMAGE")
        .imageConfig(ImageConfig.builder()
            .aspectRatio(aspectRatio)
            .imageSize(resolution)
            .build())
        .build();
    
    response = chat.sendMessage(
        "Update this infographic to be in Spanish. " + 
        "Do not change any other elements of the image.",
        config);
    
    for (Part part : response.parts()) {
      if (part.text().isPresent()) {
        System.out.println(part.text().get());
      } else if (part.inlineData().isPresent()) {
        var blob = part.inlineData().get();
        if (blob.data().isPresent()) {
          Files.write(Paths.get("photosynthesis_spanish.png"), blob.data().get());
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H 'Content-Type: application/json' \
      -d '{
        "contents": [
          {
            "role": "user",
            "parts": [{"text": "Create a vibrant infographic that explains photosynthesis..."}]
          },
          {
            "role": "model",
            "parts": [{"inline_data": {"mime_type": "image/png", "data": "<PREVIOUS_IMAGE_DATA>"}}]
          },
          {
            "role": "user",
            "parts": [{"text": "Update this infographic to be in Spanish. Do not change any other elements of the image."}]
          }
        ],
        "tools": [{"google_search": {}}],
        "generationConfig": {
          "responseModalities": ["TEXT", "IMAGE"],
          "imageConfig": {
            "aspectRatio": "16:9",
            "imageSize": "2K"
          }
        }
      }'
    
    স্প্যানিশ ভাষায় সালোকসংশ্লেষের এআই-নির্মিত ইনফোগ্রাফিক
    স্প্যানিশ ভাষায় সালোকসংশ্লেষের এআই-নির্মিত ইনফোগ্রাফিক

    জেমিনি ৩ ইমেজ মডেলের সাথে নতুন

    জেমিনি ৩ সর্বাধুনিক ইমেজ তৈরি এবং সম্পাদনার মডেল প্রদান করে। জেমিনি ৩.১ ফ্ল্যাশ ইমেজ গতি এবং বিপুল পরিমাণে ব্যবহারের জন্য অপ্টিমাইজ করা হয়েছে, এবং জেমিনি ৩ প্রো ইমেজ পেশাদার অ্যাসেট তৈরির জন্য অপ্টিমাইজ করা হয়েছে। উন্নত যুক্তির মাধ্যমে সবচেয়ে চ্যালেঞ্জিং ওয়ার্কফ্লো মোকাবেলা করার জন্য ডিজাইন করা এই মডেলগুলো জটিল, বহু-ধাপের তৈরি এবং পরিবর্তনের কাজে অত্যন্ত পারদর্শী।

    • উচ্চ-রেজোলিউশন আউটপুট : 1K, 2K, এবং 4K ভিজ্যুয়াল তৈরির জন্য অন্তর্নির্মিত সক্ষমতা।
      • জেমিনি ৩.১ ফ্ল্যাশ ইমেজ আরও ছোট ৫১২ (০.৫কে) রেজোলিউশন যোগ করে।
    • উন্নত টেক্সট রেন্ডারিং : ইনফোগ্রাফিক, মেনু, ডায়াগ্রাম এবং মার্কেটিং অ্যাসেটের জন্য সুস্পষ্ট ও শৈল্পিক টেক্সট তৈরি করতে সক্ষম।
    • গুগল সার্চের মাধ্যমে ভিত্তি স্থাপন : মডেলটি তথ্য যাচাই করতে এবং রিয়েল-টাইম ডেটার (যেমন, বর্তমান আবহাওয়ার মানচিত্র, স্টক চার্ট, সাম্প্রতিক ঘটনা) উপর ভিত্তি করে চিত্র তৈরি করতে একটি টুল হিসেবে গুগল সার্চ ব্যবহার করতে পারে।
      • জেমিনি ৩.১ ফ্ল্যাশ ইমেজ-এ ওয়েব সার্চের পাশাপাশি ছবির জন্য গুগল সার্চের সাথে গ্রাউন্ডিং-এর ইন্টিগ্রেশন যুক্ত করা হয়েছে।
    • চিন্তন মোড : মডেলটি জটিল নির্দেশাবলী নিয়ে যুক্তি দিয়ে চিন্তা করার জন্য একটি 'চিন্তা' প্রক্রিয়া ব্যবহার করে। চূড়ান্ত উচ্চ-মানের আউটপুট তৈরি করার আগে, এটি গঠনটিকে পরিমার্জন করার জন্য অন্তর্বর্তীকালীন 'চিন্তা চিত্র' (যা ব্যাকএন্ডে দেখা যায় কিন্তু চার্জ করা হয় না) তৈরি করে।
    • সর্বোচ্চ ১৪টি রেফারেন্স ছবি : আপনি এখন চূড়ান্ত ছবিটি তৈরি করার জন্য সর্বোচ্চ ১৪টি রেফারেন্স ছবি মিশ্রিত করতে পারবেন।
    • নতুন অ্যাস্পেক্ট রেশিও : জেমিনি ৩.১ ফ্ল্যাশ ইমেজ প্রিভিউতে ১:৪, ৪:১, ১:৮, এবং ৮:১ অ্যাস্পেক্ট রেশিও যোগ করা হয়েছে।

    সর্বোচ্চ ১৪টি রেফারেন্স ছবি ব্যবহার করুন

    জেমিনি ৩ ইমেজ মডেল আপনাকে সর্বোচ্চ ১৪টি রেফারেন্স ইমেজ মিশ্রিত করার সুযোগ দেয়। এই ১৪টি ইমেজের মধ্যে নিম্নলিখিতগুলো অন্তর্ভুক্ত থাকতে পারে:

    জেমিনি ৩.১ ফ্ল্যাশ ইমেজ প্রিভিউ জেমিনি ৩ প্রো ছবির প্রিভিউ
    চূড়ান্ত ছবিতে অন্তর্ভুক্ত করার জন্য বস্তুর ১০টি পর্যন্ত উচ্চ মানের ছবি। চূড়ান্ত ছবিতে অন্তর্ভুক্ত করার জন্য বস্তুসমূহের সর্বোচ্চ ৬টি উচ্চ মানের ছবি।
    চরিত্রের সামঞ্জস্য বজায় রাখতে সর্বোচ্চ ৪টি চরিত্রের ছবি ব্যবহার করা যাবে। চরিত্রের সামঞ্জস্য বজায় রাখতে সর্বাধিক ৫টি চরিত্রের ছবি ব্যবহার করা যাবে।

    পাইথন

    from google import genai
    from google.genai import types
    from PIL import Image
    
    prompt = "An office group photo of these people, they are making funny faces."
    aspect_ratio = "5:4" # "1:1","1:4","1:8","2:3","3:2","3:4","4:1","4:3","4:5","5:4","8:1","9:16","16:9","21:9"
    resolution = "2K" # "512", "1K", "2K", "4K"
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[
            prompt,
            Image.open('person1.png'),
            Image.open('person2.png'),
            Image.open('person3.png'),
            Image.open('person4.png'),
            Image.open('person5.png'),
        ],
        config=types.GenerateContentConfig(
            response_modalities=['TEXT', 'IMAGE'],
            image_config=types.ImageConfig(
                aspect_ratio=aspect_ratio,
                image_size=resolution
            ),
        )
    )
    
    for part in response.parts:
        if part.text is not None:
            print(part.text)
        elif image:= part.as_image():
            image.save("office.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const prompt =
          'An office group photo of these people, they are making funny faces.';
      const aspectRatio = '5:4';
      const resolution = '2K';
    
    const contents = [
      { text: prompt },
      {
        inlineData: {
          mimeType: "image/jpeg",
          data: base64ImageFile1,
        },
      },
      {
        inlineData: {
          mimeType: "image/jpeg",
          data: base64ImageFile2,
        },
      },
      {
        inlineData: {
          mimeType: "image/jpeg",
          data: base64ImageFile3,
        },
      },
      {
        inlineData: {
          mimeType: "image/jpeg",
          data: base64ImageFile4,
        },
      },
      {
        inlineData: {
          mimeType: "image/jpeg",
          data: base64ImageFile5,
        },
      }
    ];
    
    const response = await ai.models.generateContent({
        model: 'gemini-3.1-flash-image-preview',
        contents: contents,
        config: {
          responseModalities: ['TEXT', 'IMAGE'],
          imageConfig: {
            aspectRatio: aspectRatio,
            imageSize: resolution,
          },
        },
      });
    
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("image.png", buffer);
          console.log("Image saved as image.png");
        }
      }
    
    }
    
    main();
    

    যান

    package main
    
    import (
        "context"
        "fmt"
        "log"
        "os"
    
        "google.golang.org/genai"
    )
    
    func main() {
        ctx := context.Background()
        client, err := genai.NewClient(ctx, nil)
        if err != nil {
            log.Fatal(err)
        }
        defer client.Close()
    
        model := client.GenerativeModel("gemini-3.1-flash-image-preview")
        model.GenerationConfig = &pb.GenerationConfig{
            ResponseModalities: []pb.ResponseModality{genai.Text, genai.Image},
            ImageConfig: &pb.ImageConfig{
                AspectRatio: "5:4",
                ImageSize:   "2K",
            },
        }
    
        img1, err := os.ReadFile("person1.png")
        if err != nil { log.Fatal(err) }
        img2, err := os.ReadFile("person2.png")
        if err != nil { log.Fatal(err) }
        img3, err := os.ReadFile("person3.png")
        if err != nil { log.Fatal(err) }
        img4, err := os.ReadFile("person4.png")
        if err != nil { log.Fatal(err) }
        img5, err := os.ReadFile("person5.png")
        if err != nil { log.Fatal(err) }
    
        parts := []genai.Part{
            genai.Text("An office group photo of these people, they are making funny faces."),
            genai.ImageData{MIMEType: "image/png", Data: img1},
            genai.ImageData{MIMEType: "image/png", Data: img2},
            genai.ImageData{MIMEType: "image/png", Data: img3},
            genai.ImageData{MIMEType: "image/png", Data: img4},
            genai.ImageData{MIMEType: "image/png", Data: img5},
        }
    
        resp, err := model.GenerateContent(ctx, parts...)
        if err != nil {
            log.Fatal(err)
        }
    
        for _, part := range resp.Candidates[0].Content.Parts {
            if txt, ok := part.(genai.Text); ok {
                fmt.Printf("%s", string(txt))
            } else if img, ok := part.(genai.ImageData); ok {
                err := os.WriteFile("office.png", img.Data, 0644)
                if err != nil {
                    log.Fatal(err)
                }
            }
        }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.Content;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.ImageConfig;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    
    public class GroupPhoto {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .imageConfig(ImageConfig.builder()
                  .aspectRatio("5:4")
                  .imageSize("2K")
                  .build())
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              Content.fromParts(
                  Part.fromText("An office group photo of these people, they are making funny faces."),
                  Part.fromBytes(Files.readAllBytes(Path.of("person1.png")), "image/png"),
                  Part.fromBytes(Files.readAllBytes(Path.of("person2.png")), "image/png"),
                  Part.fromBytes(Files.readAllBytes(Path.of("person3.png")), "image/png"),
                  Part.fromBytes(Files.readAllBytes(Path.of("person4.png")), "image/png"),
                  Part.fromBytes(Files.readAllBytes(Path.of("person5.png")), "image/png")
              ), config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("office.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
        -H "x-goog-api-key: $GEMINI_API_KEY" \
        -H 'Content-Type: application/json' \
        -d "{
          \"contents\": [{
            \"parts\":[
                {\"text\": \"An office group photo of these people, they are making funny faces.\"},
                {\"inline_data\": {\"mime_type\":\"image/png\", \"data\": \"<BASE64_DATA_IMG_1>\"}},
                {\"inline_data\": {\"mime_type\":\"image/png\", \"data\": \"<BASE64_DATA_IMG_2>\"}},
                {\"inline_data\": {\"mime_type\":\"image/png\", \"data\": \"<BASE64_DATA_IMG_3>\"}},
                {\"inline_data\": {\"mime_type\":\"image/png\", \"data\": \"<BASE64_DATA_IMG_4>\"}},
                {\"inline_data\": {\"mime_type\":\"image/png\", \"data\": \"<BASE64_DATA_IMG_5>\"}}
            ]
          }],
          \"generationConfig\": {
            \"responseModalities\": [\"TEXT\", \"IMAGE\"],
            \"imageConfig\": {
              \"aspectRatio\": \"5:4\",
              \"imageSize\": \"2K\"
            }
          }
        }"
    
    এআই-জেনারেটেড অফিসের গ্রুপ ছবি
    এআই-জেনারেটেড অফিসের গ্রুপ ছবি

    গুগল সার্চের মাধ্যমে গ্রাউন্ডিং

    আবহাওয়ার পূর্বাভাস, স্টক চার্ট বা সাম্প্রতিক ঘটনার মতো রিয়েল-টাইম তথ্যের উপর ভিত্তি করে ছবি তৈরি করতে গুগল সার্চ টুল ব্যবহার করুন।

    উল্লেখ্য যে, ইমেজ জেনারেশনের সাথে গ্রাউন্ডিং উইথ গুগল সার্চ ব্যবহার করার সময়, ইমেজ-ভিত্তিক সার্চ রেজাল্টগুলো জেনারেশন মডেলে পাঠানো হয় না এবং রেসপন্স থেকে বাদ দেওয়া হয় ( ইমেজ এর জন্য গ্রাউন্ডিং উইথ গুগল সার্চ দেখুন)।

    পাইথন

    from google import genai
    prompt = "Visualize the current weather forecast for the next 5 days in San Francisco as a clean, modern weather chart. Add a visual on what I should wear each day"
    aspect_ratio = "16:9" # "1:1","1:4","1:8","2:3","3:2","3:4","4:1","4:3","4:5","5:4","8:1","9:16","16:9","21:9"
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=prompt,
        config=types.GenerateContentConfig(
            response_modalities=['Text', 'Image'],
            image_config=types.ImageConfig(
                aspect_ratio=aspect_ratio,
            ),
            tools=[{"google_search": {}}]
        )
    )
    
    for part in response.parts:
        if part.text is not None:
            print(part.text)
        elif image:= part.as_image():
            image.save("weather.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const prompt = 'Visualize the current weather forecast for the next 5 days in San Francisco as a clean, modern weather chart. Add a visual on what I should wear each day';
      const aspectRatio = '16:9';
      const resolution = '2K';
    
    const response = await ai.models.generateContent({
        model: 'gemini-3.1-flash-image-preview',
        contents: prompt,
        config: {
          responseModalities: ['TEXT', 'IMAGE'],
          imageConfig: {
            aspectRatio: aspectRatio,
            imageSize: resolution,
          },
        tools: [{ googleSearch: {} }]
        },
      });
    
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("image.png", buffer);
          console.log("Image saved as image.png");
        }
      }
    
    }
    
    main();
    
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.GoogleSearch;
    import com.google.genai.types.ImageConfig;
    import com.google.genai.types.Part;
    import com.google.genai.types.Tool;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class SearchGrounding {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .imageConfig(ImageConfig.builder()
                  .aspectRatio("16:9")
                  .build())
              .tools(Tool.builder()
                  .googleSearch(GoogleSearch.builder().build())
                  .build())
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview", """
                  Visualize the current weather forecast for the next 5 days
                  in San Francisco as a clean, modern weather chart.
                  Add a visual on what I should wear each day
                  """,
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("weather.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{"parts": [{"text": "Visualize the current weather forecast for the next 5 days in San Francisco as a clean, modern weather chart. Add a visual on what I should wear each day"}]}],
        "tools": [{"google_search": {}}],
        "generationConfig": {
          "responseModalities": ["TEXT", "IMAGE"],
          "imageConfig": {"aspectRatio": "16:9"}
        }
      }'
    
    সান ফ্রান্সিসকোর জন্য এআই-নির্মিত পাঁচ দিনের আবহাওয়ার চার্ট
    সান ফ্রান্সিসকোর জন্য এআই-নির্মিত পাঁচ দিনের আবহাওয়ার চার্ট

    প্রতিক্রিয়াটিতে groundingMetadata অন্তর্ভুক্ত রয়েছে, যাতে নিম্নলিখিত প্রয়োজনীয় ক্ষেত্রগুলি রয়েছে:

    • searchEntryPoint : প্রয়োজনীয় সার্চ সাজেশনগুলো রেন্ডার করার জন্য HTML এবং CSS ধারণ করে।
    • groundingChunks : তৈরি করা ছবিটি গ্রাউন্ড করতে ব্যবহৃত শীর্ষ ৩টি ওয়েব উৎস ফেরত দেয়।

    ইমেজের জন্য ‘গ্রাউন্ডিং উইথ গুগল সার্চ’ মডেলটিকে ইমেজ তৈরির জন্য ভিজ্যুয়াল কনটেক্সট হিসেবে গুগল সার্চের মাধ্যমে প্রাপ্ত ওয়েব ইমেজ ব্যবহার করার সুযোগ দেয়। ইমেজ সার্চ হলো বিদ্যমান ‘গ্রাউন্ডিং উইথ গুগল সার্চ’ টুলের অন্তর্ভুক্ত একটি নতুন ধরনের সার্চ, যা সাধারণ ওয়েব সার্চের পাশাপাশি কাজ করে।

    ইমেজ সার্চ সক্রিয় করতে, আপনার API অনুরোধে googleSearch টুলটি কনফিগার করুন এবং searchTypes অবজেক্টের মধ্যে imageSearch উল্লেখ করুন। ইমেজ সার্চ স্বাধীনভাবে অথবা ওয়েব সার্চের সাথে একত্রে ব্যবহার করা যেতে পারে।

    মনে রাখবেন যে, ছবির জন্য গুগল সার্চের মাধ্যমে গ্রাউন্ডিং ব্যবহার করে মানুষ খোঁজা যায় না।

    পাইথন

    from google import genai
    prompt = "A detailed painting of a Timareta butterfly resting on a flower"
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=prompt,
        config=types.GenerateContentConfig(
            response_modalities=["IMAGE"],
            tools=[
                types.Tool(google_search=types.GoogleSearch(
                    search_types=types.SearchTypes(
                        web_search=types.WebSearch(),
                        image_search=types.ImageSearch()
                    )
                ))
            ]
        )
    )
    
    # Display grounding sources if available
    if response.candidates and response.candidates[0].grounding_metadata and response.candidates[0].grounding_metadata.search_entry_point:
        display(HTML(response.candidates[0].grounding_metadata.search_entry_point.rendered_content))
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const prompt = "A detailed painting of a Timareta butterfly resting on a flower";
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
        config: {
          responseModalities: ["IMAGE"],
          tools: [
            {
              googleSearch: {
                searchTypes: {
                  webSearch: {},
                  imageSearch: {}
                }
              }
            }
          ]
        }
      });
    
      // Display grounding sources if available
      if (response.candidates && response.candidates[0].groundingMetadata && response.candidates[0].groundingMetadata.searchEntryPoint) {
          console.log(response.candidates[0].groundingMetadata.searchEntryPoint.renderedContent);
      }
    }
    
    main();
    

    যান

    package main
    
    import (
      "context"
      "fmt"
      "log"
    
      "google.golang.org/genai"
      pb "google.golang.org/genai/schema"
    )
    
    func main() {
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
        log.Fatal(err)
      }
      defer client.Close()
    
      model := client.GenerativeModel("gemini-3.1-flash-image-preview")
      model.Tools = []*pb.Tool{
        {
          GoogleSearch: &pb.GoogleSearch{
            SearchTypes: &pb.SearchTypes{
              WebSearch:   &pb.WebSearch{},
              ImageSearch: &pb.ImageSearch{},
            },
          },
        },
      }
      model.GenerationConfig = &pb.GenerationConfig{
        ResponseModalities: []pb.ResponseModality{genai.Image},
      }
    
      prompt := "A detailed painting of a Timareta butterfly resting on a flower"
      resp, err := model.GenerateContent(ctx, genai.Text(prompt))
      if err != nil {
        log.Fatal(err)
      }
    
      if resp.Candidates[0].GroundingMetadata != nil && resp.Candidates[0].GroundingMetadata.SearchEntryPoint != nil {
        fmt.Println(resp.Candidates[0].GroundingMetadata.SearchEntryPoint.RenderedContent)
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{"parts": [{"text": "A detailed painting of a Timareta butterfly resting on a flower"}]}],
        "tools": [{"google_search": {"searchTypes": {"webSearch": {}, "imageSearch": {}}}}],
        "generationConfig": {
          "responseModalities": ["IMAGE"]
        }
      }'
    

    প্রদর্শনের প্রয়োজনীয়তা

    যখন আপনি গ্রাউন্ডিং উইথ গুগল সার্চ-এর মধ্যে ইমেজ সার্চ ব্যবহার করবেন, তখন আপনাকে নিম্নলিখিত শর্তগুলি অবশ্যই মেনে চলতে হবে:

    • উৎসের উল্লেখ : আপনাকে অবশ্যই উৎস ছবিটি যে ওয়েবপেজে রয়েছে, সেটির একটি লিঙ্ক এমনভাবে প্রদান করতে হবে যাতে ব্যবহারকারী লিঙ্ক হিসেবে চিনতে পারে (লিঙ্কটি হলো ছবিটি ধারণকারী পেজ, ছবির ফাইলটি নয়)।
    • সরাসরি নেভিগেশন : আপনি যদি উৎস ছবিগুলোও প্রদর্শন করতে চান, তবে আপনাকে অবশ্যই উৎস ছবিগুলো থেকে সেগুলোর ধারণকারী মূল ওয়েবপেজে যাওয়ার জন্য একটি সরাসরি, এক-ক্লিকের পথ প্রদান করতে হবে। অন্য কোনো পদ্ধতি যা ব্যবহারকারীর উৎস ওয়েবপেজে প্রবেশে বিলম্ব ঘটায় বা বাধা সৃষ্টি করে, তা অনুমোদিত নয়; এর মধ্যে একাধিক ক্লিকের পথ বা কোনো মধ্যবর্তী ইমেজ ভিউয়ারের ব্যবহার অন্তর্ভুক্ত, তবে এতেই সীমাবদ্ধ নয়।

    প্রতিক্রিয়া

    ইমেজ সার্চ ব্যবহার করে প্রাপ্ত গ্রাউন্ডেড রেসপন্সের ক্ষেত্রে, এপিআই তার আউটপুটকে যাচাইকৃত উৎসের সাথে সংযুক্ত করার জন্য সুস্পষ্ট অ্যাট্রিবিউশন এবং মেটাডেটা প্রদান করে। groundingMetadata অবজেক্টের প্রধান ফিল্ডগুলো হলো:

    • imageSearchQueries : ভিজ্যুয়াল কনটেক্সট (ইমেজ সার্চ)-এর জন্য মডেল দ্বারা ব্যবহৃত নির্দিষ্ট কোয়েরিসমূহ।
    • groundingChunks : প্রাপ্ত ফলাফলের উৎস সম্পর্কিত তথ্য ধারণ করে। ছবির উৎসের ক্ষেত্রে, এগুলো একটি নতুন ইমেজ চাঙ্ক টাইপ ব্যবহার করে রিডাইরেক্ট ইউআরএল হিসেবে ফেরত দেওয়া হবে। এই চাঙ্কটিতে অন্তর্ভুক্ত রয়েছে:

      • uri : অ্যাট্রিবিউশনের জন্য ওয়েব পেজের ইউআরএল (ল্যান্ডিং পেজ)।
      • image_uri : ছবির সরাসরি ইউআরএল।
    • groundingSupports : নির্দিষ্ট ম্যাপিং প্রদান করে যা তৈরি করা বিষয়বস্তুকে চাঙ্কগুলির মধ্যে তার প্রাসঙ্গিক উদ্ধৃতি উৎসের সাথে সংযুক্ত করে।

    • searchEntryPoint : এতে "Google Search" চিপ অন্তর্ভুক্ত থাকে, যা সার্চ সাজেশন রেন্ডার করার জন্য উপযুক্ত HTML এবং CSS ধারণ করে।

    4K রেজোলিউশন পর্যন্ত ছবি তৈরি করুন

    জেমিনি ৩ ইমেজ মডেলগুলো ডিফল্টভাবে ১কে (1K) ইমেজ তৈরি করে, তবে এটি ২কে (2K), ৪কে (4K), এবং ৫১২ (0.5K) (শুধুমাত্র জেমিনি ৩.১ ফ্ল্যাশ ইমেজের ক্ষেত্রে) ইমেজও আউটপুট করতে পারে। উচ্চতর রেজোলিউশনের অ্যাসেট তৈরি করতে, generation_configimage_size নির্দিষ্ট করে দিন।

    আপনাকে অবশ্যই বড় হাতের 'K' ব্যবহার করতে হবে (যেমন 1K, 2K, 4K)। 512 মানের ক্ষেত্রে 'K' সাফিক্স ব্যবহৃত হয় না। ছোট হাতের অক্ষরের প্যারামিটার (যেমন, 1k) বাতিল করা হবে।

    পাইথন

    from google import genai
    from google.genai import types
    
    prompt = "Da Vinci style anatomical sketch of a dissected Monarch butterfly. Detailed drawings of the head, wings, and legs on textured parchment with notes in English."
    aspect_ratio = "1:1" # "1:1","1:4","1:8","2:3","3:2","3:4","4:1","4:3","4:5","5:4","8:1","9:16","16:9","21:9"
    resolution = "1K" # "512", "1K", "2K", "4K"
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=prompt,
        config=types.GenerateContentConfig(
            response_modalities=['TEXT', 'IMAGE'],
            image_config=types.ImageConfig(
                aspect_ratio=aspect_ratio,
                image_size=resolution
            ),
        )
    )
    
    for part in response.parts:
        if part.text is not None:
            print(part.text)
        elif image:= part.as_image():
            image.save("butterfly.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const prompt =
          'Da Vinci style anatomical sketch of a dissected Monarch butterfly. Detailed drawings of the head, wings, and legs on textured parchment with notes in English.';
      const aspectRatio = '1:1';
      const resolution = '1K';
    
      const response = await ai.models.generateContent({
        model: 'gemini-3.1-flash-image-preview',
        contents: prompt,
        config: {
          responseModalities: ['TEXT', 'IMAGE'],
          imageConfig: {
            aspectRatio: aspectRatio,
            imageSize: resolution,
          },
        },
      });
    
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("image.png", buffer);
          console.log("Image saved as image.png");
        }
      }
    
    }
    
    main();
    

    যান

    package main
    
    import (
        "context"
        "fmt"
        "log"
        "os"
    
        "google.golang.org/genai"
    )
    
    func main() {
        ctx := context.Background()
        client, err := genai.NewClient(ctx, nil)
        if err != nil {
            log.Fatal(err)
        }
        defer client.Close()
    
        model := client.GenerativeModel("gemini-3.1-flash-image-preview")
        model.GenerationConfig = &pb.GenerationConfig{
            ResponseModalities: []pb.ResponseModality{genai.Text, genai.Image},
            ImageConfig: &pb.ImageConfig{
                AspectRatio: "1:1",
                ImageSize:   "1K",
            },
        }
    
        prompt := "Da Vinci style anatomical sketch of a dissected Monarch butterfly. Detailed drawings of the head, wings, and legs on textured parchment with notes in English."
        resp, err := model.GenerateContent(ctx, genai.Text(prompt))
        if err != nil {
            log.Fatal(err)
        }
    
        for _, part := range resp.Candidates[0].Content.Parts {
            if txt, ok := part.(genai.Text); ok {
                fmt.Printf("%s", string(txt))
            } else if img, ok := part.(genai.ImageData); ok {
                err := os.WriteFile("butterfly.png", img.Data, 0644)
                if err != nil {
                    log.Fatal(err)
                }
            }
        }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.GoogleSearch;
    import com.google.genai.types.ImageConfig;
    import com.google.genai.types.Part;
    import com.google.genai.types.Tool;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class HiRes {
        public static void main(String[] args) throws IOException {
    
          try (Client client = new Client()) {
            GenerateContentConfig config = GenerateContentConfig.builder()
                .responseModalities("TEXT", "IMAGE")
                .imageConfig(ImageConfig.builder()
                    .aspectRatio("16:9")
                    .imageSize("4K")
                    .build())
                .build();
    
            GenerateContentResponse response = client.models.generateContent(
                "gemini-3.1-flash-image-preview", """
                  Da Vinci style anatomical sketch of a dissected Monarch butterfly.
                  Detailed drawings of the head, wings, and legs on textured
                  parchment with notes in English.
                  """,
                config);
    
            for (Part part : response.parts()) {
              if (part.text().isPresent()) {
                System.out.println(part.text().get());
              } else if (part.inlineData().isPresent()) {
                var blob = part.inlineData().get();
                if (blob.data().isPresent()) {
                  Files.write(Paths.get("butterfly.png"), blob.data().get());
                }
              }
            }
          }
        }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{"parts": [{"text": "Da Vinci style anatomical sketch of a dissected Monarch butterfly. Detailed drawings of the head, wings, and legs on textured parchment with notes in English."}]}],
        "tools": [{"google_search": {}}],
        "generationConfig": {
          "responseModalities": ["TEXT", "IMAGE"],
          "imageConfig": {"aspectRatio": "1:1", "imageSize": "1K"}
        }
      }'
    

    নিম্নলিখিতটি এই প্রম্পট থেকে তৈরি একটি উদাহরণ চিত্র:

    কৃত্রিম বুদ্ধিমত্তা দ্বারা নির্মিত, দা ভিঞ্চি শৈলীর ব্যবচ্ছেদ করা একটি মোনার্ক প্রজাপতির শারীরবৃত্তীয় চিত্র।
    কৃত্রিম বুদ্ধিমত্তা দ্বারা নির্মিত, দা ভিঞ্চি শৈলীর ব্যবচ্ছেদ করা একটি মোনার্ক প্রজাপতির শারীরবৃত্তীয় চিত্র।

    চিন্তন প্রক্রিয়া

    জেমিনি ৩ ইমেজ মডেল হলো এমন চিন্তাশীল মডেল যা জটিল নির্দেশনার জন্য একটি যুক্তি প্রক্রিয়া ("চিন্তা") ব্যবহার করে। এই বৈশিষ্ট্যটি ডিফল্টরূপে সক্রিয় থাকে এবং এপিআই-তে এটি নিষ্ক্রিয় করা যায় না। চিন্তা প্রক্রিয়া সম্পর্কে আরও জানতে, জেমিনি থিঙ্কিং গাইডটি দেখুন।

    মডেলটি কম্পোজিশন ও লজিক পরীক্ষা করার জন্য সর্বোচ্চ দুটি অন্তর্বর্তীকালীন ছবি তৈরি করে। ‘থিংকিং’-এর ভেতরের শেষ ছবিটিই হলো চূড়ান্ত রেন্ডার করা ছবি।

    চূড়ান্ত ছবিটি তৈরির পেছনের ভাবনাগুলো আপনি যাচাই করে দেখতে পারেন।

    পাইথন

    for part in response.parts:
        if part.thought:
            if part.text:
                print(part.text)
            elif image:= part.as_image():
                image.show()
    

    জাভাস্ক্রিপ্ট

    for (const part of response.candidates[0].content.parts) {
      if (part.thought) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, 'base64');
          fs.writeFileSync('image.png', buffer);
          console.log('Image saved as image.png');
        }
      }
    }
    

    চিন্তার স্তর নিয়ন্ত্রণ করা

    জেমিনি ৩.১ ফ্ল্যাশ ইমেজের সাহায্যে, আপনি কোয়ালিটি এবং ল্যাটেন্সির মধ্যে ভারসাম্য বজায় রাখতে মডেলটির চিন্তাভাবনার পরিমাণ নিয়ন্ত্রণ করতে পারেন। ডিফল্ট thinkingLevel হলো minimal , এবং সমর্থিত লেভেলগুলো হলো minimalhighthinkingLevel minimal সেট করলে সর্বনিম্ন ল্যাটেন্সির প্রতিক্রিয়া পাওয়া যায়। মনে রাখবেন যে, মিনিমাল থিঙ্কিং-এর অর্থ এই নয় যে মডেলটি একেবারেই কোনো চিন্তাভাবনা ব্যবহার করে না।

    মডেল দ্বারা তৈরি চিন্তাগুলো প্রতিক্রিয়ায় ফেরত দেওয়া হবে, নাকি গোপন থাকবে, তা নির্ধারণ করতে আপনি includeThoughts বুলিয়ানটি যোগ করতে পারেন।

    পাইথন

    from google import genai
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents="A futuristic city built inside a giant glass bottle floating in space",
        config=types.GenerateContentConfig(
            response_modalities=["IMAGE"],
            thinking_config=types.ThinkingConfig(
                thinking_level="High",
                include_thoughts=True
            ),
        )
    )
    
    for part in response.parts:
        if part.thought: # Skip outputting thoughts
          continue
        if part.text:
          display(Markdown(part.text))
        elif image:= part.as_image():
          image.show()
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: "A futuristic city built inside a giant glass bottle floating in space",
        config: {
          responseModalities: ["IMAGE"],
          thinkingConfig: {
            thinkingLevel: "High",
            includeThoughts: true
          },
        },
      });
    
      for (const part of response.candidates[0].content.parts) {
        if (part.thought) { // Skip outputting thoughts
          continue;
        }
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("image.png", buffer);
          console.log("Image saved as image.png");
        }
      }
    }
    main();
    

    যান

    package main
    
    import (
        "context"
        "fmt"
        "log"
        "os"
    
        "google.golang.org/genai"
        pb "google.golang.org/genai/schema"
    )
    
    func main() {
        ctx := context.Background()
        client, err := genai.NewClient(ctx, nil)
        if err != nil {
            log.Fatal(err)
        }
        defer client.Close()
    
        model := client.GenerativeModel("gemini-3.1-flash-image-preview")
        model.GenerationConfig = &pb.GenerationConfig{
            ResponseModalities: []pb.ResponseModality{genai.Image},
            ThinkingConfig: &pb.ThinkingConfig{
                ThinkingLevel:   "High",
                IncludeThoughts: true,
            },
        }
    
        prompt := "A futuristic city built inside a giant glass bottle floating in space"
        resp, err := model.GenerateContent(ctx, genai.Text(prompt))
        if err != nil {
            log.Fatal(err)
        }
    
        for _, part := range resp.Candidates[0].Content.Parts {
            if part.Thought { // Skip outputting thoughts
                continue
            }
            if txt, ok := part.(genai.Text); ok {
                fmt.Printf("%s", string(txt))
            } else if img, ok := part.(genai.ImageData); ok {
                err := os.WriteFile("image.png", img.Data, 0644)
                if err != nil {
                    log.Fatal(err)
                }
            }
        }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{"parts": [{"text": "A futuristic city built inside a giant glass bottle floating in space"}]}],
        "generationConfig": {
          "responseModalities": ["IMAGE"],
          "thinkingConfig": {
            "thinkingLevel": "High",
            "includeThoughts": true
          }
        }
      }'
    

    মনে রাখবেন যে includeThoughts মান true বা false যাই সেট করা থাকুক না কেন, থিংকিং টোকেনের জন্য বিল করা হয়, কারণ আপনি প্রক্রিয়াটি দেখুন বা না দেখুন, চিন্তন প্রক্রিয়াটি ডিফল্টরূপে সর্বদা চলতে থাকে।

    চিন্তার স্বাক্ষর

    থট সিগনেচার হলো মডেলের অভ্যন্তরীণ চিন্তন প্রক্রিয়ার এনক্রিপ্টেড উপস্থাপনা এবং এটি একাধিক টার্নের ইন্টারঅ্যাকশন জুড়ে যুক্তির প্রেক্ষাপট সংরক্ষণ করতে ব্যবহৃত হয়। সমস্ত রেসপন্সে একটি thought_signature ফিল্ড থাকে। সাধারণ নিয়ম হলো, যদি আপনি কোনো মডেল রেসপন্সে একটি থট সিগনেচার পান, তবে পরবর্তী টার্নে কনভারসেশন হিস্ট্রি পাঠানোর সময় সেটি ঠিক যেভাবে পেয়েছেন সেভাবেই ফেরত পাঠানো উচিত। থট সিগনেচার সার্কুলেট করতে ব্যর্থ হলে রেসপন্সটি ব্যর্থ হতে পারে। সিগনেচার সম্পর্কে সার্বিকভাবে আরও ব্যাখ্যার জন্য থট সিগনেচার ডকুমেন্টেশন দেখুন।

    চিন্তার স্বাক্ষর যেভাবে কাজ করে তা এখানে দেওয়া হলো:

    • রেসপন্সের অংশ হিসেবে থাকা ইমেজ mimetype সমস্ত inline_data অংশে সিগনেচার থাকা উচিত।
    • যদি শুরুতে (কোনো ছবির আগে) মূল ভাবনার ঠিক পরেই কিছু লেখা থাকে, তাহলে প্রথম লেখাটিতেও একটি স্বাক্ষর থাকতে হবে।
    • যদি ইমেজ mimetype সহ inline_data অংশগুলো চিন্তার অংশ হয়, তাহলে সেগুলোর কোনো সিগনেচার থাকবে না।

    নিম্নলিখিত কোডটিতে চিন্তার স্বাক্ষর অন্তর্ভুক্ত করার একটি উদাহরণ দেখানো হয়েছে:

    [
      {
        "inline_data": {
          "data": "<base64_image_data_0>",
          "mime_type": "image/png"
        },
        "thought": true // Thoughts don't have signatures
      },
      {
        "inline_data": {
          "data": "<base64_image_data_1>",
          "mime_type": "image/png"
        },
        "thought": true // Thoughts don't have signatures
      },
      {
        "inline_data": {
          "data": "<base64_image_data_2>",
          "mime_type": "image/png"
        },
        "thought": true // Thoughts don't have signatures
      },
      {
        "text": "Here is a step-by-step guide to baking macarons, presented in three separate images.\n\n### Step 1: Piping the Batter\n\nThe first step after making your macaron batter is to pipe it onto a baking sheet. This requires a steady hand to create uniform circles.\n\n",
        "thought_signature": "<Signature_A>" // The first non-thought part always has a signature
      },
      {
        "inline_data": {
          "data": "<base64_image_data_3>",
          "mime_type": "image/png"
        },
        "thought_signature": "<Signature_B>" // All image parts have a signatures
      },
      {
        "text": "\n\n### Step 2: Baking and Developing Feet\n\nOnce piped, the macarons are baked in the oven. A key sign of a successful bake is the development of \"feet\"—the ruffled edge at the base of each macaron shell.\n\n"
        // Follow-up text parts don't have signatures
      },
      {
        "inline_data": {
          "data": "<base64_image_data_4>",
          "mime_type": "image/png"
        },
        "thought_signature": "<Signature_C>" // All image parts have a signatures
      },
      {
        "text": "\n\n### Step 3: Assembling the Macaron\n\nThe final step is to pair the cooled macaron shells by size and sandwich them together with your desired filling, creating the classic macaron dessert.\n\n"
      },
      {
        "inline_data": {
          "data": "<base64_image_data_5>",
          "mime_type": "image/png"
        },
        "thought_signature": "<Signature_D>" // All image parts have a signatures
      }
    ]
    

    অন্যান্য ছবি তৈরির মোড

    জেমিনি প্রম্পটের গঠন ও প্রসঙ্গের উপর ভিত্তি করে অন্যান্য ইমেজ ইন্টারঅ্যাকশন মোড সমর্থন করে, যার মধ্যে রয়েছে:

    • টেক্সট থেকে ছবি এবং টেক্সট (সমন্বিত): সংশ্লিষ্ট টেক্সট সহ ছবি আউটপুট করে।
      • উদাহরণস্বরূপ নির্দেশ: "পায়েল্লার একটি সচিত্র রেসিপি তৈরি করুন।"
    • ছবি ও লেখা থেকে ছবি ও লেখায় (সমন্বিত) : ইনপুট করা ছবি ও লেখা ব্যবহার করে নতুন সম্পর্কিত ছবি ও লেখা তৈরি করে।
      • উদাহরণস্বরূপ জিজ্ঞাসা: (সাজানো একটি ঘরের ছবি সহ) "আমার এই জায়গায় আর কী কী রঙের সোফা মানাবে? আপনি কি ছবিটি আপডেট করতে পারবেন?"

    ব্যাচে ছবি তৈরি করুন

    আপনার যদি প্রচুর পরিমাণে ইমেজ তৈরি করার প্রয়োজন হয়, তাহলে আপনি ব্যাচ এপিআই (Batch API) ব্যবহার করতে পারেন। এর বিনিময়ে আপনি সর্বোচ্চ ২৪ ঘণ্টা পর্যন্ত ডেলিভারির শর্তে উচ্চতর রেট লিমিট পাবেন।

    ব্যাচ এপিআই ইমেজ জেনারেশন ডকুমেন্টেশন এবং কুকবুকটি ব্যাচ এপিআই ইমেজের উদাহরণ ও কোডের জন্য দেখুন।

    প্রম্পটিং গাইড এবং কৌশল

    ইমেজ জেনারেশনে দক্ষতা অর্জনের সূচনা হয় একটি মৌলিক নীতি দিয়ে:

    দৃশ্যটির বর্ণনা দিন, শুধু মূলশব্দের তালিকা করবেন না। মডেলটির মূল শক্তি হলো এর গভীর ভাষাবোধ। বিচ্ছিন্ন শব্দের তালিকার চেয়ে একটি বর্ণনামূলক অনুচ্ছেদ প্রায় সবসময়ই একটি উন্নততর ও অধিকতর সুসংহত চিত্র ফুটিয়ে তোলে।

    ছবি তৈরির জন্য নির্দেশিকা

    নিম্নলিখিত কৌশলগুলো আপনাকে ঠিক সেই ছবিগুলো তৈরি করার জন্য কার্যকর নির্দেশিকা তৈরি করতে সাহায্য করবে যা আপনি খুঁজছেন।

    ১. আলোকচিত্রের মতো বাস্তবসম্মত দৃশ্য

    বাস্তবসম্মত ছবির জন্য ফটোগ্রাফির পরিভাষা ব্যবহার করুন। মডেলকে ফটোরিয়ালিস্টিক ফলাফলের দিকে পরিচালিত করতে ক্যামেরার অ্যাঙ্গেল, লেন্সের ধরন, আলো এবং সূক্ষ্ম বিবরণের উল্লেখ করুন।

    টেমপ্লেট

    A photorealistic [shot type] of [subject], [action or expression], set in
    [environment]. The scene is illuminated by [lighting description], creating
    a [mood] atmosphere. Captured with a [camera/lens details], emphasizing
    [key textures and details]. The image should be in a [aspect ratio] format.
    

    প্রম্পট

    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. The setting is his rustic,
    sun-drenched workshop. The scene is illuminated by soft, golden hour light
    streaming through a window, highlighting the fine texture of the clay.
    Captured with an 85mm portrait lens, resulting in a soft, blurred background
    (bokeh). The overall mood is serene and masterful. Vertical portrait
    orientation.
    

    পাইথন

    from google import genai
    from google.genai import types
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents="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. The setting is his rustic, sun-drenched workshop with pottery wheels and shelves of clay pots in the background. The scene is illuminated by soft, golden hour light streaming through a window, highlighting the fine texture of the clay and the fabric of his apron. Captured with an 85mm portrait lens, resulting in a soft, blurred background (bokeh). The overall mood is serene and masterful.",
    )
    
    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("photorealistic_example.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const 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. The setting is his rustic, sun-drenched workshop with pottery wheels and shelves of clay pots in the background. The scene is illuminated by soft, golden hour light streaming through a window, highlighting the fine texture of the clay and the fabric of his apron. Captured with an 85mm portrait lens, resulting in a soft, blurred background (bokeh). The overall mood is serene and masterful.";
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("photorealistic_example.png", buffer);
          console.log("Image saved as photorealistic_example.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
        "context"
        "fmt"
        "log"
        "os"
        "google.golang.org/genai"
    )
    
    func main() {
    
        ctx := context.Background()
        client, err := genai.NewClient(ctx, nil)
        if err != nil {
            log.Fatal(err)
        }
    
        result, _ := client.Models.GenerateContent(
            ctx,
            "gemini-3.1-flash-image-preview",
            genai.Text("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. The setting is his rustic, sun-drenched workshop with pottery wheels and shelves of clay pots in the background. The scene is illuminated by soft, golden hour light streaming through a window, highlighting the fine texture of the clay and the fabric of his apron. Captured with an 85mm portrait lens, resulting in a soft, blurred background (bokeh). The overall mood is serene and masterful."),
        )
    
        for _, part := range result.Candidates[0].Content.Parts {
            if part.Text != "" {
                fmt.Println(part.Text)
            } else if part.InlineData != nil {
                imageBytes := part.InlineData.Data
                outputFilename := "photorealistic_example.png"
                _ = os.WriteFile(outputFilename, imageBytes, 0644)
            }
        }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class PhotorealisticScene {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              """
              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. The setting is his
              rustic, sun-drenched workshop with pottery wheels and shelves of
              clay pots in the background. The scene is illuminated by soft,
              golden hour light streaming through a window, highlighting the
              fine texture of the clay and the fabric of his apron. Captured
              with an 85mm portrait lens, resulting in a soft, blurred
              background (bokeh). The overall mood is serene and masterful.
              """,
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("photorealistic_example.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{
          "parts": [
            {"text": "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. The setting is his rustic, sun-drenched workshop with pottery wheels and shelves of clay pots in the background. The scene is illuminated by soft, golden hour light streaming through a window, highlighting the fine texture of the clay and the fabric of his apron. Captured with an 85mm portrait lens, resulting in a soft, blurred background (bokeh). The overall mood is serene and masterful."}
          ]
        }]
      }'
    
    একজন বয়স্ক জাপানি মৃৎশিল্পীর একটি আলোকচিত্র-সদৃশ কাছ থেকে তোলা প্রতিকৃতি...
    একজন বয়স্ক জাপানি মৃৎশিল্পীর একটি আলোকচিত্র-সদৃশ কাছ থেকে তোলা প্রতিকৃতি...

    ২. শৈল্পিক চিত্র ও স্টিকার

    স্টিকার, আইকন বা অ্যাসেট তৈরি করার জন্য, স্টাইল সম্পর্কে সুস্পষ্টভাবে উল্লেখ করুন এবং একটি স্বচ্ছ ব্যাকগ্রাউন্ডের অনুরোধ করুন।

    টেমপ্লেট

    A [style] sticker of a [subject], featuring [key characteristics] and a
    [color palette]. The design should have [line style] and [shading style].
    The background must be transparent.
    

    প্রম্পট

    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. The background must be white.
    

    পাইথন

    from google import genai
    from google.genai import types
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents="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. The background must be white.",
    )
    
    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("red_panda_sticker.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const 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. The background must be white.";
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("red_panda_sticker.png", buffer);
          console.log("Image saved as red_panda_sticker.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
        "context"
        "fmt"
        "log"
        "os"
        "google.golang.org/genai"
    )
    
    func main() {
    
        ctx := context.Background()
        client, err := genai.NewClient(ctx, nil)
        if err != nil {
            log.Fatal(err)
        }
    
        result, _ := client.Models.GenerateContent(
            ctx,
            "gemini-3.1-flash-image-preview",
            genai.Text("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. The background must be white."),
        )
    
        for _, part := range result.Candidates[0].Content.Parts {
            if part.Text != "" {
                fmt.Println(part.Text)
            } else if part.InlineData != nil {
                imageBytes := part.InlineData.Data
                outputFilename := "red_panda_sticker.png"
                _ = os.WriteFile(outputFilename, imageBytes, 0644)
            }
        }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class StylizedIllustration {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              """
              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. The background must be white.
              """,
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("red_panda_sticker.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{
          "parts": [
            {"text": "A kawaii-style sticker of a happy red panda wearing a tiny bamboo hat. It is munching on a green bamboo leaf. The design features bold, clean outlines, simple cel-shading, and a vibrant color palette. The background must be white."}
          ]
        }]
      }'
    
    একটি হাসিখুশি লাল রঙের কাওয়াই-শৈলীর স্টিকার...
    একটি হাসিখুশি লাল পান্ডার কাওয়াই-শৈলীর স্টিকার...

    ৩. ছবিতে সঠিক লেখা

    জেমিনি টেক্সট রেন্ডার করার ক্ষেত্রে অত্যন্ত পারদর্শী। টেক্সট, ফন্ট স্টাইল (বর্ণনামূলকভাবে) এবং সামগ্রিক ডিজাইন সম্পর্কে স্পষ্ট ধারণা রাখুন। পেশাদার অ্যাসেট তৈরির জন্য জেমিনি ৩ প্রো ইমেজ প্রিভিউ ব্যবহার করুন।

    টেমপ্লেট

    Create a [image type] for [brand/concept] with the text "[text to render]"
    in a [font style]. The design should be [style description], with a
    [color scheme].
    

    প্রম্পট

    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. Put the logo in a circle. Use a coffee bean in a clever way.
    

    পাইথন

    from google import genai
    from google.genai import types    
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents="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. Put the logo in a circle. Use a coffee bean in a clever way.",
        config=types.GenerateContentConfig(
            image_config=types.ImageConfig(
                aspect_ratio="1:1",
            )
        )
    )
    
    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("logo_example.jpg")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const prompt =
        "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. Put the logo in a circle. Use a coffee bean in a clever way.";
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
        config: {
          imageConfig: {
            aspectRatio: "1:1",
          },
        },
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("logo_example.jpg", buffer);
          console.log("Image saved as logo_example.jpg");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
        "context"
        "fmt"
        "log"
        "os"
        "google.golang.org/genai"
    )
    
    func main() {
    
        ctx := context.Background()
        client, err := genai.NewClient(ctx, nil)
        if err != nil {
            log.Fatal(err)
        }
    
        result, _ := client.Models.GenerateContent(
            ctx,
            "gemini-3.1-flash-image-preview",
            genai.Text("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. Put the logo in a circle. Use a coffee bean in a clever way."),
            &genai.GenerateContentConfig{
                ImageConfig: &genai.ImageConfig{
                  AspectRatio: "1:1",
                },
            },
        )
    
        for _, part := range result.Candidates[0].Content.Parts {
            if part.Text != "" {
                fmt.Println(part.Text)
            } else if part.InlineData != nil {
                imageBytes := part.InlineData.Data
                outputFilename := "logo_example.jpg"
                _ = os.WriteFile(outputFilename, imageBytes, 0644)
            }
        }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    import com.google.genai.types.ImageConfig;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class AccurateTextInImages {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .imageConfig(ImageConfig.builder()
                  .aspectRatio("1:1")
                  .build())
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              """
              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. Put the logo in a circle. Use a coffee bean in a clever way.
              """,
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("logo_example.jpg"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{
          "parts": [
            {"text": "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. Put the logo in a circle. Use a coffee bean in a clever way."}
          ]
        }],
        "generationConfig": {
          "imageConfig": {
            "aspectRatio": "1:1"
          }
        }
      }'
    
    'দ্য ডেইলি গ্রাইন্ড' নামক একটি কফি শপের জন্য একটি আধুনিক, মিনিমালিস্ট লোগো তৈরি করুন...
    'দ্য ডেইলি গ্রাইন্ড' নামক একটি কফি শপের জন্য একটি আধুনিক, মিনিমালিস্ট লোগো তৈরি করুন...

    ৪. পণ্যের মকআপ ও বাণিজ্যিক ফটোগ্রাফি

    ই-কমার্স, বিজ্ঞাপন বা ব্র্যান্ডিংয়ের জন্য পরিচ্ছন্ন ও পেশাদার মানের পণ্যের ছবি তোলার জন্য এটি নিখুঁত।

    টেমপ্লেট

    A high-resolution, studio-lit product photograph of a [product description]
    on a [background surface/description]. The lighting is a [lighting setup,
    e.g., three-point softbox setup] to [lighting purpose]. The camera angle is
    a [angle type] to showcase [specific feature]. Ultra-realistic, with sharp
    focus on [key detail]. [Aspect ratio].
    

    প্রম্পট

    A high-resolution, studio-lit product photograph of a minimalist ceramic
    coffee mug in matte black, presented on a polished concrete surface. The
    lighting is a three-point softbox setup designed to create soft, diffused
    highlights and eliminate harsh shadows. The camera angle is a slightly
    elevated 45-degree shot to showcase its clean lines. Ultra-realistic, with
    sharp focus on the steam rising from the coffee. Square image.
    

    পাইথন

    from google import genai
    from google.genai import types
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents="A high-resolution, studio-lit product photograph of a minimalist ceramic coffee mug in matte black, presented on a polished concrete surface. The lighting is a three-point softbox setup designed to create soft, diffused highlights and eliminate harsh shadows. The camera angle is a slightly elevated 45-degree shot to showcase its clean lines. Ultra-realistic, with sharp focus on the steam rising from the coffee. Square image.",
    )
    
    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("product_mockup.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const prompt =
        "A high-resolution, studio-lit product photograph of a minimalist ceramic coffee mug in matte black, presented on a polished concrete surface. The lighting is a three-point softbox setup designed to create soft, diffused highlights and eliminate harsh shadows. The camera angle is a slightly elevated 45-degree shot to showcase its clean lines. Ultra-realistic, with sharp focus on the steam rising from the coffee. Square image.";
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("product_mockup.png", buffer);
          console.log("Image saved as product_mockup.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
        "context"
        "fmt"
        "log"
        "os"
        "google.golang.org/genai"
    )
    
    func main() {
    
        ctx := context.Background()
        client, err := genai.NewClient(ctx, nil)
        if err != nil {
            log.Fatal(err)
        }
    
        result, _ := client.Models.GenerateContent(
            ctx,
            "gemini-3.1-flash-image-preview",
            genai.Text("A high-resolution, studio-lit product photograph of a minimalist ceramic coffee mug in matte black, presented on a polished concrete surface. The lighting is a three-point softbox setup designed to create soft, diffused highlights and eliminate harsh shadows. The camera angle is a slightly elevated 45-degree shot to showcase its clean lines. Ultra-realistic, with sharp focus on the steam rising from the coffee. Square image."),
        )
    
        for _, part := range result.Candidates[0].Content.Parts {
            if part.Text != "" {
                fmt.Println(part.Text)
            } else if part.InlineData != nil {
                imageBytes := part.InlineData.Data
                outputFilename := "product_mockup.png"
                _ = os.WriteFile(outputFilename, imageBytes, 0644)
            }
        }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class ProductMockup {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              """
              A high-resolution, studio-lit product photograph of a minimalist
              ceramic coffee mug in matte black, presented on a polished
              concrete surface. The lighting is a three-point softbox setup
              designed to create soft, diffused highlights and eliminate harsh
              shadows. The camera angle is a slightly elevated 45-degree shot
              to showcase its clean lines. Ultra-realistic, with sharp focus
              on the steam rising from the coffee. Square image.
              """,
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("product_mockup.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{
          "parts": [
            {"text": "A high-resolution, studio-lit product photograph of a minimalist ceramic coffee mug in matte black, presented on a polished concrete surface. The lighting is a three-point softbox setup designed to create soft, diffused highlights and eliminate harsh shadows. The camera angle is a slightly elevated 45-degree shot to showcase its clean lines. Ultra-realistic, with sharp focus on the steam rising from the coffee. Square image."}
          ]
        }]
      }'
    
    একটি মিনিমালিস্ট সিরামিক কফি মগের উচ্চ রেজোলিউশনের, স্টুডিওর আলোয় তোলা পণ্যের ছবি...
    একটি মিনিমালিস্ট সিরামিক কফি মগের উচ্চ রেজোলিউশনের, স্টুডিওর আলোয় তোলা পণ্যের ছবি...

    ৫. ন্যূনতমবাদী ও নেতিবাচক স্থান নকশা

    ওয়েবসাইট, প্রেজেন্টেশন বা মার্কেটিং উপকরণের ব্যাকগ্রাউন্ড তৈরির জন্য এটি চমৎকার, যেখানে টেক্সট যুক্ত করা হবে।

    টেমপ্লেট

    A minimalist composition featuring a single [subject] positioned in the
    [bottom-right/top-left/etc.] of the frame. The background is a vast, empty
    [color] canvas, creating significant negative space. Soft, subtle lighting.
    [Aspect ratio].
    

    প্রম্পট

    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, creating significant negative space for text. Soft,
    diffused lighting from the top left. Square image.
    

    পাইথন

    from google import genai
    from google.genai import types    
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents="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, creating significant negative space for text. Soft, diffused lighting from the top left. Square image.",
    )
    
    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("minimalist_design.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const 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, creating significant negative space for text. Soft, diffused lighting from the top left. Square image.";
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("minimalist_design.png", buffer);
          console.log("Image saved as minimalist_design.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
        "context"
        "fmt"
        "log"
        "os"
        "google.golang.org/genai"
    )
    
    func main() {
    
        ctx := context.Background()
        client, err := genai.NewClient(ctx, nil)
        if err != nil {
            log.Fatal(err)
        }
    
        result, _ := client.Models.GenerateContent(
            ctx,
            "gemini-3.1-flash-image-preview",
            genai.Text("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, creating significant negative space for text. Soft, diffused lighting from the top left. Square image."),
        )
    
        for _, part := range result.Candidates[0].Content.Parts {
            if part.Text != "" {
                fmt.Println(part.Text)
            } else if part.InlineData != nil {
                imageBytes := part.InlineData.Data
                outputFilename := "minimalist_design.png"
                _ = os.WriteFile(outputFilename, imageBytes, 0644)
            }
        }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class MinimalistDesign {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              """
              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, creating significant negative
              space for text. Soft, diffused lighting from the top left.
              Square image.
              """,
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("minimalist_design.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{
          "parts": [
            {"text": "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, creating significant negative space for text. Soft, diffused lighting from the top left. Square image."}
          ]
        }]
      }'
    
    একটি একক, কোমল লাল ম্যাপেল পাতাকে বৈশিষ্ট্যযুক্ত করে একটি ন্যূনতম শিল্পকর্ম...
    একটি একক, কোমল লাল ম্যাপেল পাতাকে বৈশিষ্ট্যযুক্ত করে একটি ন্যূনতম শিল্পকর্ম...

    ৬. ক্রমিক শিল্প (কমিক প্যানেল / স্টোরিবোর্ড)

    চরিত্রের সামঞ্জস্য এবং দৃশ্যের বর্ণনার উপর ভিত্তি করে ভিজ্যুয়াল স্টোরিটেলিং-এর জন্য প্যানেল তৈরি করে। টেক্সটের নির্ভুলতা এবং গল্প বলার ক্ষমতার জন্য, এই প্রম্পটগুলি Gemini 3 Pro এবং Gemini 3.1 Flash Image Preview-এর সাথে সবচেয়ে ভালোভাবে কাজ করে।

    টেমপ্লেট

    Make a 3 panel comic in a [style]. Put the character in a [type of scene].
    

    প্রম্পট

    Make a 3 panel comic in a gritty, noir art style with high-contrast black and white inks. Put the character in a humurous scene.
    

    পাইথন

    from google import genai
    from google.genai import types
    from PIL import Image
    
    client = genai.Client()
    
    image_input = Image.open('/path/to/your/man_in_white_glasses.jpg')
    text_input = "Make a 3 panel comic in a gritty, noir art style with high-contrast black and white inks. Put the character in a humurous scene."
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[text_input, image_input],
    )
    
    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("comic_panel.jpg")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const imagePath = "/path/to/your/man_in_white_glasses.jpg";
      const imageData = fs.readFileSync(imagePath);
      const base64Image = imageData.toString("base64");
    
      const prompt = [
        {text: "Make a 3 panel comic in a gritty, noir art style with high-contrast black and white inks. Put the character in a humurous scene."},
        {
          inlineData: {
            mimeType: "image/jpeg",
            data: base64Image,
          },
        },
      ];
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("comic_panel.jpg", buffer);
          console.log("Image saved as comic_panel.jpg");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
        "context"
        "fmt"
        "log"
        "os"
        "google.golang.org/genai"
    )
    
    func main() {
    
        ctx := context.Background()
        client, err := genai.NewClient(ctx, nil)
        if err != nil {
            log.Fatal(err)
        }
    
        imagePath := "/path/to/your/man_in_white_glasses.jpg"
        imgData, _ := os.ReadFile(imagePath)
    
        parts := []*genai.Part{
          genai.NewPartFromText("Make a 3 panel comic in a gritty, noir art style with high-contrast black and white inks. Put the character in a humurous scene."),
          &genai.Part{
            InlineData: &genai.Blob{
              MIMEType: "image/jpeg",
              Data:     imgData,
            },
          },
        }
    
        contents := []*genai.Content{
          genai.NewContentFromParts(parts, genai.RoleUser),
        }
    
        result, _ := client.Models.GenerateContent(
            ctx,
            "gemini-3.1-flash-image-preview",
            contents,
        )
    
        for _, part := range result.Candidates[0].Content.Parts {
            if part.Text != "" {
                fmt.Println(part.Text)
            } else if part.InlineData != nil {
                imageBytes := part.InlineData.Data
                outputFilename := "comic_panel.jpg"
                _ = os.WriteFile(outputFilename, imageBytes, 0644)
            }
        }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.Content;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    
    public class ComicPanel {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              Content.fromParts(
                  Part.fromText("""
                      Make a 3 panel comic in a gritty, noir art style with high-contrast black and white inks. Put the character in a humurous scene.
                      """),
                  Part.fromBytes(
                      Files.readAllBytes(
                          Path.of("/path/to/your/man_in_white_glasses.jpg")),
                      "image/jpeg")),
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("comic_panel.jpg"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{
          "parts": [
            {"text": "Make a 3 panel comic in a gritty, noir art style with high-contrast black and white inks. Put the character in a humurous scene."},
            {"inline_data": {"mime_type": "image/jpeg", "data": "<BASE64_IMAGE_DATA>"}}
          ]
        }]
      }'
    

    ইনপুট

    আউটপুট

    সাদা চশমা পরা লোক
    ইনপুট ছবি
    রুক্ষ ও নোয়ার শিল্পশৈলীতে একটি ৩ প্যানেলের কমিক তৈরি করুন...
    রুক্ষ ও নোয়ার শিল্পশৈলীতে একটি ৩ প্যানেলের কমিক তৈরি করুন...

    সাম্প্রতিক বা রিয়েল-টাইম তথ্যের ভিত্তিতে ছবি তৈরি করতে গুগল সার্চ ব্যবহার করুন। এটি সংবাদ, আবহাওয়া এবং অন্যান্য জরুরি বিষয়ের জন্য উপযোগী।

    প্রম্পট

    Make a simple but stylish graphic of last night's Arsenal game in the Champion's League
    

    পাইথন

    from google import genai
    from google.genai import types
    prompt = "Make a simple but stylish graphic of last night's Arsenal game in the Champion's League"
    aspect_ratio = "16:9" # "1:1","1:4","1:8","2:3","3:2","3:4","4:1","4:3","4:5","5:4","8:1","9:16","16:9","21:9"
    
    client = genai.Client()
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=prompt,
        config=types.GenerateContentConfig(
            response_modalities=['Text', 'Image'],
            image_config=types.ImageConfig(
                aspect_ratio=aspect_ratio,
            ),
            tools=[{"google_search": {}}]
        )
    )
    
    for part in response.parts:
        if part.text is not None:
            print(part.text)
        elif image:= part.as_image():
            image.save("football-score.jpg")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const prompt = "Make a simple but stylish graphic of last night's Arsenal game in the Champion's League";
    
      const aspectRatio = '16:9';
      const resolution = '2K';
    
    const response = await ai.models.generateContent({
        model: 'gemini-3.1-flash-image-preview',
        contents: prompt,
        config: {
          responseModalities: ['TEXT', 'IMAGE'],
          imageConfig: {
            aspectRatio: aspectRatio,
            imageSize: resolution,
          },
          tools: [{"google_search": {}}],
        },
      });
    
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("football-score.jpg", buffer);
          console.log("Image saved as football-score.jpg");
        }
      }
    
    }
    
    main();
    
    

    যান

    package main
    
    import (
        "context"
        "fmt"
        "log"
        "os"
    
        "google.golang.org/genai"
        pb "google.golang.org/genai/schema"
    )
    
    func main() {
        ctx := context.Background()
        client, err := genai.NewClient(ctx, nil)
        if err != nil {
            log.Fatal(err)
        }
        defer client.Close()
    
        model := client.GenerativeModel("gemini-3.1-flash-image-preview")
        model.Tools = []*pb.Tool{
            pb.NewGoogleSearchTool(),
        }
        model.GenerationConfig = &pb.GenerationConfig{
            ResponseModalities: []pb.ResponseModality{genai.Text, genai.Image},
            ImageConfig: &pb.ImageConfig{
                AspectRatio: "16:9",
            },
        }
    
        prompt := "Make a simple but stylish graphic of last night's Arsenal game in the Champion's League"
        resp, err := model.GenerateContent(ctx, genai.Text(prompt))
        if err != nil {
            log.Fatal(err)
        }
    
        for _, part := range resp.Candidates[0].Content.Parts {
            if txt, ok := part.(genai.Text); ok {
                fmt.Printf("%s", string(txt))
            } else if img, ok := part.(genai.ImageData); ok {
                err := os.WriteFile("football-score.jpg", img.Data, 0644)
                if err != nil {
                    log.Fatal(err)
                }
            }
        }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.GoogleSearch;
    import com.google.genai.types.ImageConfig;
    import com.google.genai.types.Part;
    import com.google.genai.types.Tool;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class SearchGrounding {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .imageConfig(ImageConfig.builder()
                  .aspectRatio("16:9")
                  .build())
              .tools(Tool.builder()
                  .googleSearch(GoogleSearch.builder().build())
                  .build())
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview", """
                  Make a simple but stylish graphic of last night's Arsenal game in the Champion's League
                  """,
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("football-score.jpg"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{"parts": [{"text": "Make a simple but stylish graphic of last nights Arsenal game in the Champions League"}]}],
        "tools": [{"google_search": {}}],
        "generationConfig": {
          "responseModalities": ["TEXT", "IMAGE"],
          "imageConfig": {"aspectRatio": "16:9"}
        }
      }'
    
    আর্সেনাল ফুটবল ম্যাচের স্কোরের এআই-নির্মিত গ্রাফিক
    আর্সেনাল ফুটবল ম্যাচের স্কোরের এআই-নির্মিত গ্রাফিক

    ছবি সম্পাদনার জন্য নির্দেশিকা

    এই উদাহরণগুলো দেখায় কীভাবে সম্পাদনা, বিন্যাস এবং শৈলী স্থানান্তরের জন্য আপনার পাঠ্য নির্দেশনার পাশাপাশি ছবি যুক্ত করতে হয়।

    ১. উপাদান যোগ করা এবং অপসারণ করা

    একটি ছবি দিন এবং আপনার পরিবর্তনটি বর্ণনা করুন। মডেলটিকে মূল ছবির শৈলী, আলো এবং দৃষ্টিকোণের সাথে মিলতে হবে।

    টেমপ্লেট

    Using the provided image of [subject], please [add/remove/modify] [element]
    to/from the scene. Ensure the change is [description of how the change should
    integrate].
    

    প্রম্পট

    "Using the provided image of my cat, please add a small, knitted wizard hat
    on its head. Make it look like it's sitting comfortably and matches the soft
    lighting of the photo."
    

    পাইথন

    from google import genai
    from google.genai import types
    from PIL import Image
    
    client = genai.Client()
    
    # Base image prompt: "A photorealistic picture of a fluffy ginger cat sitting on a wooden floor, looking directly at the camera. Soft, natural light from a window."
    image_input = Image.open('/path/to/your/cat_photo.png')
    text_input = """Using the provided image of my cat, please add a small, knitted wizard hat on its head. Make it look like it's sitting comfortably and not falling off."""
    
    # Generate an image from a text prompt
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[text_input, image_input],
    )
    
    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("cat_with_hat.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const imagePath = "/path/to/your/cat_photo.png";
      const imageData = fs.readFileSync(imagePath);
      const base64Image = imageData.toString("base64");
    
      const prompt = [
        { text: "Using the provided image of my cat, please add a small, knitted wizard hat on its head. Make it look like it's sitting comfortably and not falling off." },
        {
          inlineData: {
            mimeType: "image/png",
            data: base64Image,
          },
        },
      ];
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("cat_with_hat.png", buffer);
          console.log("Image saved as cat_with_hat.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
      "context"
      "fmt"
      "log"
      "os"
      "google.golang.org/genai"
    )
    
    func main() {
    
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
    
      imagePath := "/path/to/your/cat_photo.png"
      imgData, _ := os.ReadFile(imagePath)
    
      parts := []*genai.Part{
        genai.NewPartFromText("Using the provided image of my cat, please add a small, knitted wizard hat on its head. Make it look like it's sitting comfortably and not falling off."),
        &genai.Part{
          InlineData: &genai.Blob{
            MIMEType: "image/png",
            Data:     imgData,
          },
        },
      }
    
      contents := []*genai.Content{
        genai.NewContentFromParts(parts, genai.RoleUser),
      }
    
      result, _ := client.Models.GenerateContent(
          ctx,
          "gemini-3.1-flash-image-preview",
          contents,
      )
    
      for _, part := range result.Candidates[0].Content.Parts {
          if part.Text != "" {
              fmt.Println(part.Text)
          } else if part.InlineData != nil {
              imageBytes := part.InlineData.Data
              outputFilename := "cat_with_hat.png"
              _ = os.WriteFile(outputFilename, imageBytes, 0644)
          }
      }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.Content;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    
    public class AddRemoveElements {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              Content.fromParts(
                  Part.fromText("""
                      Using the provided image of my cat, please add a small,
                      knitted wizard hat on its head. Make it look like it's
                      sitting comfortably and not falling off.
                      """),
                  Part.fromBytes(
                      Files.readAllBytes(
                          Path.of("/path/to/your/cat_photo.png")),
                      "image/png")),
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("cat_with_hat.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
        -H "x-goog-api-key: $GEMINI_API_KEY" \
        -H 'Content-Type: application/json' \
        -d "{
          \"contents\": [{
            \"parts\":[
                {\"text\": \"Using the provided image of my cat, please add a small, knitted wizard hat on its head. Make it look like it's sitting comfortably and not falling off.\"},
                {
                  \"inline_data\": {
                    \"mime_type\":\"image/png\",
                    \"data\": \"<BASE64_IMAGE_DATA>\"
                  }
                }
            ]
          }]
        }"
    

    ইনপুট

    আউটপুট

    একটি তুলতুলে আদা-রঙা বিড়ালের আলোকচিত্রের মতো বাস্তবসম্মত ছবি।
    একটি তুলতুলে আদা-রঙা বিড়ালের আলোকচিত্রের মতো বাস্তবসম্মত ছবি...
    আমার বিড়ালের দেওয়া ছবিটি ব্যবহার করে, অনুগ্রহ করে একটি ছোট বোনা জাদুকরের টুপি যোগ করুন...
    আমার বিড়ালের দেওয়া ছবিটি ব্যবহার করে, অনুগ্রহ করে একটি ছোট বোনা জাদুকরের টুপি যোগ করুন...

    ২. ইনপেইন্টিং (সিমান্টিক মাস্কিং)

    ছবির বাকি অংশ অপরিবর্তিত রেখে একটি নির্দিষ্ট অংশ সম্পাদনা করার জন্য কথোপকথনের সময় একটি 'মাস্ক' নির্ধারণ করুন।

    টেমপ্লেট

    Using the provided image, change only the [specific element] to [new
    element/description]. Keep everything else in the image exactly the same,
    preserving the original style, lighting, and composition.
    

    প্রম্পট

    "Using the provided image of a living room, change only the blue sofa to be
    a vintage, brown leather chesterfield sofa. Keep the rest of the room,
    including the pillows on the sofa and the lighting, unchanged."
    

    পাইথন

    from google import genai
    from google.genai import types
    from PIL import Image
    
    client = genai.Client()
    
    # Base image prompt: "A wide shot of a modern, well-lit living room with a prominent blue sofa in the center. A coffee table is in front of it and a large window is in the background."
    living_room_image = Image.open('/path/to/your/living_room.png')
    text_input = """Using the provided image of a living room, change only the blue sofa to be a vintage, brown leather chesterfield sofa. Keep the rest of the room, including the pillows on the sofa and the lighting, unchanged."""
    
    # Generate an image from a text prompt
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[living_room_image, text_input],
    )
    
    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("living_room_edited.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const imagePath = "/path/to/your/living_room.png";
      const imageData = fs.readFileSync(imagePath);
      const base64Image = imageData.toString("base64");
    
      const prompt = [
        {
          inlineData: {
            mimeType: "image/png",
            data: base64Image,
          },
        },
        { text: "Using the provided image of a living room, change only the blue sofa to be a vintage, brown leather chesterfield sofa. Keep the rest of the room, including the pillows on the sofa and the lighting, unchanged." },
      ];
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("living_room_edited.png", buffer);
          console.log("Image saved as living_room_edited.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
      "context"
      "fmt"
      "log"
      "os"
      "google.golang.org/genai"
    )
    
    func main() {
    
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
    
      imagePath := "/path/to/your/living_room.png"
      imgData, _ := os.ReadFile(imagePath)
    
      parts := []*genai.Part{
        &genai.Part{
          InlineData: &genai.Blob{
            MIMEType: "image/png",
            Data:     imgData,
          },
        },
        genai.NewPartFromText("Using the provided image of a living room, change only the blue sofa to be a vintage, brown leather chesterfield sofa. Keep the rest of the room, including the pillows on the sofa and the lighting, unchanged."),
      }
    
      contents := []*genai.Content{
        genai.NewContentFromParts(parts, genai.RoleUser),
      }
    
      result, _ := client.Models.GenerateContent(
          ctx,
          "gemini-3.1-flash-image-preview",
          contents,
      )
    
      for _, part := range result.Candidates[0].Content.Parts {
          if part.Text != "" {
              fmt.Println(part.Text)
          } else if part.InlineData != nil {
              imageBytes := part.InlineData.Data
              outputFilename := "living_room_edited.png"
              _ = os.WriteFile(outputFilename, imageBytes, 0644)
          }
      }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.Content;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    
    public class Inpainting {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              Content.fromParts(
                  Part.fromBytes(
                      Files.readAllBytes(
                          Path.of("/path/to/your/living_room.png")),
                      "image/png"),
                  Part.fromText("""
                      Using the provided image of a living room, change
                      only the blue sofa to be a vintage, brown leather
                      chesterfield sofa. Keep the rest of the room,
                      including the pillows on the sofa and the lighting,
                      unchanged.
                      """)),
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("living_room_edited.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
        -H "x-goog-api-key: $GEMINI_API_KEY" \
        -H 'Content-Type: application/json' \
        -d "{
          \"contents\": [{
            \"parts\":[
                {
                  \"inline_data\": {
                    \"mime_type\":\"image/png\",
                    \"data\": \"<BASE64_IMAGE_DATA>\"
                  }
                },
                {\"text\": \"Using the provided image of a living room, change only the blue sofa to be a vintage, brown leather chesterfield sofa. Keep the rest of the room, including the pillows on the sofa and the lighting, unchanged.\"}
            ]
          }]
        }"
    

    ইনপুট

    আউটপুট

    একটি আধুনিক, আলো ঝলমলে বসার ঘরের ওয়াইড শট...
    একটি আধুনিক, আলো ঝলমলে বসার ঘরের ওয়াইড শট...
    প্রদত্ত বসার ঘরের ছবিটি ব্যবহার করে, শুধুমাত্র নীল সোফাটিকে একটি ভিন্টেজ, বাদামী চামড়ার চেস্টারফিল্ড সোফায় পরিবর্তন করুন...
    প্রদত্ত বসার ঘরের ছবিটি ব্যবহার করে, শুধুমাত্র নীল সোফাটিকে একটি ভিন্টেজ, বাদামী চামড়ার চেস্টারফিল্ড সোফায় পরিবর্তন করুন...

    ৩. শৈলী স্থানান্তর

    একটি ছবি দিন এবং মডেলকে সেটির বিষয়বস্তু ভিন্ন শৈলীতে পুনরায় তৈরি করতে বলুন।

    টেমপ্লেট

    Transform the provided photograph of [subject] into the artistic style of [artist/art style]. Preserve the original composition but render it with [description of stylistic elements].
    

    প্রম্পট

    "Transform the provided photograph of a modern city street at night into the artistic style of Vincent van Gogh's 'Starry Night'. Preserve the original composition of buildings and cars, but render all elements with swirling, impasto brushstrokes and a dramatic palette of deep blues and bright yellows."
    

    পাইথন

    from google import genai
    from google.genai import types
    from PIL import Image
    
    client = genai.Client()
    
    # Base image prompt: "A photorealistic, high-resolution photograph of a busy city street in New York at night, with bright neon signs, yellow taxis, and tall skyscrapers."
    city_image = Image.open('/path/to/your/city.png')
    text_input = """Transform the provided photograph of a modern city street at night into the artistic style of Vincent van Gogh's 'Starry Night'. Preserve the original composition of buildings and cars, but render all elements with swirling, impasto brushstrokes and a dramatic palette of deep blues and bright yellows."""
    
    # Generate an image from a text prompt
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[city_image, text_input],
    )
    
    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("city_style_transfer.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const imagePath = "/path/to/your/city.png";
      const imageData = fs.readFileSync(imagePath);
      const base64Image = imageData.toString("base64");
    
      const prompt = [
        {
          inlineData: {
            mimeType: "image/png",
            data: base64Image,
          },
        },
        { text: "Transform the provided photograph of a modern city street at night into the artistic style of Vincent van Gogh's 'Starry Night'. Preserve the original composition of buildings and cars, but render all elements with swirling, impasto brushstrokes and a dramatic palette of deep blues and bright yellows." },
      ];
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("city_style_transfer.png", buffer);
          console.log("Image saved as city_style_transfer.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
      "context"
      "fmt"
      "log"
      "os"
      "google.golang.org/genai"
    )
    
    func main() {
    
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
    
      imagePath := "/path/to/your/city.png"
      imgData, _ := os.ReadFile(imagePath)
    
      parts := []*genai.Part{
        &genai.Part{
          InlineData: &genai.Blob{
            MIMEType: "image/png",
            Data:     imgData,
          },
        },
        genai.NewPartFromText("Transform the provided photograph of a modern city street at night into the artistic style of Vincent van Gogh's 'Starry Night'. Preserve the original composition of buildings and cars, but render all elements with swirling, impasto brushstrokes and a dramatic palette of deep blues and bright yellows."),
      }
    
      contents := []*genai.Content{
        genai.NewContentFromParts(parts, genai.RoleUser),
      }
    
      result, _ := client.Models.GenerateContent(
          ctx,
          "gemini-3.1-flash-image-preview",
          contents,
      )
    
      for _, part := range result.Candidates[0].Content.Parts {
          if part.Text != "" {
              fmt.Println(part.Text)
          } else if part.InlineData != nil {
              imageBytes := part.InlineData.Data
              outputFilename := "city_style_transfer.png"
              _ = os.WriteFile(outputFilename, imageBytes, 0644)
          }
      }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.Content;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    
    public class StyleTransfer {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              Content.fromParts(
                  Part.fromBytes(
                      Files.readAllBytes(
                          Path.of("/path/to/your/city.png")),
                      "image/png"),
                  Part.fromText("""
                      Transform the provided photograph of a modern city
                      street at night into the artistic style of
                      Vincent van Gogh's 'Starry Night'. Preserve the
                      original composition of buildings and cars, but
                      render all elements with swirling, impasto
                      brushstrokes and a dramatic palette of deep blues
                      and bright yellows.
                      """)),
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("city_style_transfer.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
        -H "x-goog-api-key: $GEMINI_API_KEY" \
        -H 'Content-Type: application/json' \
        -d "{
          \"contents\": [{
            \"parts\":[
                {
                  \"inline_data\": {
                    \"mime_type\":\"image/png\",
                    \"data\": \"<BASE64_IMAGE_DATA>\"
                  }
                },
                {\"text\": \"Transform the provided photograph of a modern city street at night into the artistic style of Vincent van Gogh's 'Starry Night'. Preserve the original composition of buildings and cars, but render all elements with swirling, impasto brushstrokes and a dramatic palette of deep blues and bright yellows.\"}
            ]
          }]
        }"
    

    ইনপুট

    আউটপুট

    একটি ব্যস্ত শহরের রাস্তার আলোকচিত্রের মতো বাস্তবসম্মত, উচ্চ রেজোলিউশনের ছবি...
    একটি ব্যস্ত শহরের রাস্তার আলোকচিত্রের মতো বাস্তবসম্মত, উচ্চ রেজোলিউশনের ছবি...
    রাতের একটি আধুনিক শহরের রাস্তার প্রদত্ত ছবিটি রূপান্তর করুন...
    রাতের একটি আধুনিক শহরের রাস্তার প্রদত্ত ছবিটি রূপান্তর করুন...

    ৪. উন্নত কম্পোজিশন: একাধিক ছবির সমন্বয়

    একটি নতুন, যৌগিক দৃশ্য তৈরি করতে প্রেক্ষাপট হিসেবে একাধিক ছবি ব্যবহার করুন। এটি পণ্যের মকআপ বা সৃজনশীল কোলাজের জন্য আদর্শ।

    টেমপ্লেট

    Create a new image by combining the elements from the provided images. Take
    the [element from image 1] and place it with/on the [element from image 2].
    The final image should be a [description of the final scene].
    

    প্রম্পট

    "Create a professional e-commerce fashion photo. Take the blue floral dress
    from the first image and let the woman from the second image wear it.
    Generate a realistic, full-body shot of the woman wearing the dress, with
    the lighting and shadows adjusted to match the outdoor environment."
    

    পাইথন

    from google import genai
    from google.genai import types
    from PIL import Image
    
    client = genai.Client()
    
    # Base image prompts:
    # 1. Dress: "A professionally shot photo of a blue floral summer dress on a plain white background, ghost mannequin style."
    # 2. Model: "Full-body shot of a woman with her hair in a bun, smiling, standing against a neutral grey studio background."
    dress_image = Image.open('/path/to/your/dress.png')
    model_image = Image.open('/path/to/your/model.png')
    
    text_input = """Create a professional e-commerce fashion photo. Take the blue floral dress from the first image and let the woman from the second image wear it. Generate a realistic, full-body shot of the woman wearing the dress, with the lighting and shadows adjusted to match the outdoor environment."""
    
    # Generate an image from a text prompt
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[dress_image, model_image, text_input],
    )
    
    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("fashion_ecommerce_shot.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const imagePath1 = "/path/to/your/dress.png";
      const imageData1 = fs.readFileSync(imagePath1);
      const base64Image1 = imageData1.toString("base64");
      const imagePath2 = "/path/to/your/model.png";
      const imageData2 = fs.readFileSync(imagePath2);
      const base64Image2 = imageData2.toString("base64");
    
      const prompt = [
        {
          inlineData: {
            mimeType: "image/png",
            data: base64Image1,
          },
        },
        {
          inlineData: {
            mimeType: "image/png",
            data: base64Image2,
          },
        },
        { text: "Create a professional e-commerce fashion photo. Take the blue floral dress from the first image and let the woman from the second image wear it. Generate a realistic, full-body shot of the woman wearing the dress, with the lighting and shadows adjusted to match the outdoor environment." },
      ];
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("fashion_ecommerce_shot.png", buffer);
          console.log("Image saved as fashion_ecommerce_shot.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
      "context"
      "fmt"
      "log"
      "os"
      "google.golang.org/genai"
    )
    
    func main() {
    
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
    
      imgData1, _ := os.ReadFile("/path/to/your/dress.png")
      imgData2, _ := os.ReadFile("/path/to/your/model.png")
    
      parts := []*genai.Part{
        &genai.Part{
          InlineData: &genai.Blob{
            MIMEType: "image/png",
            Data:     imgData1,
          },
        },
        &genai.Part{
          InlineData: &genai.Blob{
            MIMEType: "image/png",
            Data:     imgData2,
          },
        },
        genai.NewPartFromText("Create a professional e-commerce fashion photo. Take the blue floral dress from the first image and let the woman from the second image wear it. Generate a realistic, full-body shot of the woman wearing the dress, with the lighting and shadows adjusted to match the outdoor environment."),
      }
    
      contents := []*genai.Content{
        genai.NewContentFromParts(parts, genai.RoleUser),
      }
    
      result, _ := client.Models.GenerateContent(
          ctx,
          "gemini-3.1-flash-image-preview",
          contents,
      )
    
      for _, part := range result.Candidates[0].Content.Parts {
          if part.Text != "" {
              fmt.Println(part.Text)
          } else if part.InlineData != nil {
              imageBytes := part.InlineData.Data
              outputFilename := "fashion_ecommerce_shot.png"
              _ = os.WriteFile(outputFilename, imageBytes, 0644)
          }
      }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.Content;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    
    public class AdvancedComposition {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              Content.fromParts(
                  Part.fromBytes(
                      Files.readAllBytes(
                          Path.of("/path/to/your/dress.png")),
                      "image/png"),
                  Part.fromBytes(
                      Files.readAllBytes(
                          Path.of("/path/to/your/model.png")),
                      "image/png"),
                  Part.fromText("""
                      Create a professional e-commerce fashion photo.
                      Take the blue floral dress from the first image and
                      let the woman from the second image wear it. Generate
                      a realistic, full-body shot of the woman wearing the
                      dress, with the lighting and shadows adjusted to
                      match the outdoor environment.
                      """)),
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("fashion_ecommerce_shot.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
        -H "x-goog-api-key: $GEMINI_API_KEY" \
        -H 'Content-Type: application/json' \
        -d "{
          \"contents\": [{
            \"parts\":[
                {
                  \"inline_data\": {
                    \"mime_type\":\"image/png\",
                    \"data\": \"<BASE64_IMAGE_DATA_1>\"
                  }
                },
                {
                  \"inline_data\": {
                    \"mime_type\":\"image/png\",
                    \"data\": \"<BASE64_IMAGE_DATA_2>\"
                  }
                },
                {\"text\": \"Create a professional e-commerce fashion photo. Take the blue floral dress from the first image and let the woman from the second image wear it. Generate a realistic, full-body shot of the woman wearing the dress, with the lighting and shadows adjusted to match the outdoor environment.\"}
            ]
          }]
        }"
    

    ইনপুট ১

    ইনপুট ২

    আউটপুট

    পেশাদারভাবে তোলা একটি নীল ফুলের নকশার গ্রীষ্মকালীন পোশাকের ছবি...
    পেশাদারভাবে তোলা একটি নীল ফুলের নকশার গ্রীষ্মকালীন পোশাকের ছবি...
    খোঁপা করা চুলসহ এক মহিলার পুরো শরীরের ছবি...
    খোঁপা করা চুলসহ এক মহিলার পুরো শরীরের ছবি...
    একটি পেশাদার ই-কমার্স ফ্যাশন ফটো তৈরি করুন...
    একটি পেশাদার ই-কমার্স ফ্যাশন ফটো তৈরি করুন...

    ৫. উচ্চ মানের বিশদ বিবরণ সংরক্ষণ

    সম্পাদনার সময় গুরুত্বপূর্ণ বিবরণ (যেমন মুখ বা লোগো) যাতে অক্ষুণ্ণ থাকে, তা নিশ্চিত করতে আপনার সম্পাদনার অনুরোধের সাথে সেগুলোর বিশদ বর্ণনা দিন।

    টেমপ্লেট

    Using the provided images, place [element from image 2] onto [element from
    image 1]. Ensure that the features of [element from image 1] remain
    completely unchanged. The added element should [description of how the
    element should integrate].
    

    প্রম্পট

    "Take the first image of the woman with brown hair, blue eyes, and a neutral
    expression. Add the logo from the second image onto her black t-shirt.
    Ensure the woman's face and features remain completely unchanged. The logo
    should look like it's naturally printed on the fabric, following the folds
    of the shirt."
    

    পাইথন

    from google import genai
    from google.genai import types
    from PIL import Image
    
    client = genai.Client()
    
    # Base image prompts:
    # 1. Woman: "A professional headshot of a woman with brown hair and blue eyes, wearing a plain black t-shirt, against a neutral studio background."
    # 2. Logo: "A simple, modern logo with the letters 'G' and 'A' in a white circle."
    woman_image = Image.open('/path/to/your/woman.png')
    logo_image = Image.open('/path/to/your/logo.png')
    text_input = """Take the first image of the woman with brown hair, blue eyes, and a neutral expression. Add the logo from the second image onto her black t-shirt. Ensure the woman's face and features remain completely unchanged. The logo should look like it's naturally printed on the fabric, following the folds of the shirt."""
    
    # Generate an image from a text prompt
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[woman_image, logo_image, text_input],
    )
    
    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("woman_with_logo.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const imagePath1 = "/path/to/your/woman.png";
      const imageData1 = fs.readFileSync(imagePath1);
      const base64Image1 = imageData1.toString("base64");
      const imagePath2 = "/path/to/your/logo.png";
      const imageData2 = fs.readFileSync(imagePath2);
      const base64Image2 = imageData2.toString("base64");
    
      const prompt = [
        {
          inlineData: {
            mimeType: "image/png",
            data: base64Image1,
          },
        },
        {
          inlineData: {
            mimeType: "image/png",
            data: base64Image2,
          },
        },
        { text: "Take the first image of the woman with brown hair, blue eyes, and a neutral expression. Add the logo from the second image onto her black t-shirt. Ensure the woman's face and features remain completely unchanged. The logo should look like it's naturally printed on the fabric, following the folds of the shirt." },
      ];
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("woman_with_logo.png", buffer);
          console.log("Image saved as woman_with_logo.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
      "context"
      "fmt"
      "log"
      "os"
      "google.golang.org/genai"
    )
    
    func main() {
    
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
    
      imgData1, _ := os.ReadFile("/path/to/your/woman.png")
      imgData2, _ := os.ReadFile("/path/to/your/logo.png")
    
      parts := []*genai.Part{
        &genai.Part{
          InlineData: &genai.Blob{
            MIMEType: "image/png",
            Data:     imgData1,
          },
        },
        &genai.Part{
          InlineData: &genai.Blob{
            MIMEType: "image/png",
            Data:     imgData2,
          },
        },
        genai.NewPartFromText("Take the first image of the woman with brown hair, blue eyes, and a neutral expression. Add the logo from the second image onto her black t-shirt. Ensure the woman's face and features remain completely unchanged. The logo should look like it's naturally printed on the fabric, following the folds of the shirt."),
      }
    
      contents := []*genai.Content{
        genai.NewContentFromParts(parts, genai.RoleUser),
      }
    
      result, _ := client.Models.GenerateContent(
          ctx,
          "gemini-3.1-flash-image-preview",
          contents,
      )
    
      for _, part := range result.Candidates[0].Content.Parts {
          if part.Text != "" {
              fmt.Println(part.Text)
          } else if part.InlineData != nil {
              imageBytes := part.InlineData.Data
              outputFilename := "woman_with_logo.png"
              _ = os.WriteFile(outputFilename, imageBytes, 0644)
          }
      }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.Content;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    
    public class HighFidelity {
      public static void main(String[] args) throws IOException {
    
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              Content.fromParts(
                  Part.fromBytes(
                      Files.readAllBytes(
                          Path.of("/path/to/your/woman.png")),
                      "image/png"),
                  Part.fromBytes(
                      Files.readAllBytes(
                          Path.of("/path/to/your/logo.png")),
                      "image/png"),
                  Part.fromText("""
                      Take the first image of the woman with brown hair,
                      blue eyes, and a neutral expression. Add the logo
                      from the second image onto her black t-shirt.
                      Ensure the woman's face and features remain
                      completely unchanged. The logo should look like
                      it's naturally printed on the fabric, following
                      the folds of the shirt.
                      """)),
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("woman_with_logo.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
        -H "x-goog-api-key: $GEMINI_API_KEY" \
        -H 'Content-Type: application/json' \
        -d "{
          \"contents\": [{
            \"parts\":[
                {
                  \"inline_data\": {
                    \"mime_type\":\"image/png\",
                    \"data\": \"<BASE64_IMAGE_DATA_1>\"
                  }
                },
                {
                  \"inline_data\": {
                    \"mime_type\":\"image/png\",
                    \"data\": \"<BASE64_IMAGE_DATA_2>\"
                  }
                },
                {\"text\": \"Take the first image of the woman with brown hair, blue eyes, and a neutral expression. Add the logo from the second image onto her black t-shirt. Ensure the woman's face and features remain completely unchanged. The logo should look like it's naturally printed on the fabric, following the folds of the shirt.\"}
            ]
          }]
        }"
    

    ইনপুট ১

    ইনপুট ২

    আউটপুট

    বাদামী চুল ও নীল চোখের একজন মহিলার পেশাদারী হেডশট...
    বাদামী চুল ও নীল চোখের একজন মহিলার পেশাদারী হেডশট...
    'G' এবং 'A' অক্ষর দিয়ে একটি সরল, আধুনিক লোগো...
    'G' এবং 'A' অক্ষর দিয়ে একটি সরল, আধুনিক লোগো...
    বাদামী চুল, নীল চোখ এবং ভাবলেশহীন অভিব্যক্তিযুক্ত মহিলাটির প্রথম ছবিটি নিন...
    বাদামী চুল, নীল চোখ এবং ভাবলেশহীন অভিব্যক্তিযুক্ত মহিলাটির প্রথম ছবিটি নিন...

    ৬. কোনো কিছুকে প্রাণবন্ত করে তোলা

    একটি প্রাথমিক স্কেচ বা অঙ্কন আপলোড করুন এবং মডেলকে সেটিকে পরিমার্জন করে একটি সম্পূর্ণ ছবিতে পরিণত করতে বলুন।

    টেমপ্লেট

    Turn this rough [medium] sketch of a [subject] into a [style description]
    photo. Keep the [specific features] from the sketch but add [new details/materials].
    

    প্রম্পট

    "Turn this rough pencil sketch of a futuristic car into a polished photo of the finished concept car in a showroom. Keep the sleek lines and low profile from the sketch but add metallic blue paint and neon rim lighting."
    

    পাইথন

    from google import genai
    from PIL import Image
    
    client = genai.Client()
    
    # Base image prompt: "A rough pencil sketch of a flat sports car on white paper."
    sketch_image = Image.open('/path/to/your/car_sketch.png')
    text_input = """Turn this rough pencil sketch of a futuristic car into a polished photo of the finished concept car in a showroom. Keep the sleek lines and low profile from the sketch but add metallic blue paint and neon rim lighting."""
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[sketch_image, text_input],
    )
    
    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("car_photo.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const imagePath = "/path/to/your/car_sketch.png";
      const imageData = fs.readFileSync(imagePath);
      const base64Image = imageData.toString("base64");
    
      const prompt = [
        {
          inlineData: {
            mimeType: "image/png",
            data: base64Image,
          },
        },
        { text: "Turn this rough pencil sketch of a futuristic car into a polished photo of the finished concept car in a showroom. Keep the sleek lines and low profile from the sketch but add metallic blue paint and neon rim lighting." },
      ];
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("car_photo.png", buffer);
          console.log("Image saved as car_photo.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
      "context"
      "fmt"
      "log"
      "os"
      "google.golang.org/genai"
    )
    
    func main() {
    
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
    
      imgData, _ := os.ReadFile("/path/to/your/car_sketch.png")
    
      parts := []*genai.Part{
        &genai.Part{
          InlineData: &genai.Blob{
            MIMEType: "image/png",
            Data:     imgData,
          },
        },
        genai.NewPartFromText("Turn this rough pencil sketch of a futuristic car into a polished photo of the finished concept car in a showroom. Keep the sleek lines and low profile from the sketch but add metallic blue paint and neon rim lighting."),
      }
    
      contents := []*genai.Content{
        genai.NewContentFromParts(parts, genai.RoleUser),
      }
    
      result, _ := client.Models.GenerateContent(
          ctx,
          "gemini-3.1-flash-image-preview",
          contents,
      )
    
      for _, part := range result.Candidates[0].Content.Parts {
          if part.Text != "" {
              fmt.Println(part.Text)
          } else if part.InlineData != nil {
              imageBytes := part.InlineData.Data
              outputFilename := "car_photo.png"
              _ = os.WriteFile(outputFilename, imageBytes, 0644)
          }
      }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.Content;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    
    public class BringToLife {
      public static void main(String[] args) throws IOException {
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              Content.fromParts(
                  Part.fromBytes(
                      Files.readAllBytes(
                          Path.of("/path/to/your/car_sketch.png")),
                      "image/png"),
                  Part.fromText("""
                      Turn this rough pencil sketch of a futuristic car into a polished photo of the finished concept car in a showroom. Keep the sleek lines and low profile from the sketch but add metallic blue paint and neon rim lighting.
                      """)),
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("car_photo.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
        -H "x-goog-api-key: $GEMINI_API_KEY" \
        -H 'Content-Type: application/json' \
        -d "{
          \"contents\": [{
            \"parts\":[
                {
                  \"inline_data\": {
                    \"mime_type\":\"image/png\",
                    \"data\": \"<BASE64_IMAGE_DATA>\"
                  }
                },
                {\"text\": \"Turn this rough pencil sketch of a futuristic car into a polished photo of the finished concept car in a showroom. Keep the sleek lines and low profile from the sketch but add metallic blue paint and neon rim lighting.\"}
            ]
          }]
        }"
    

    ইনপুট

    আউটপুট

    গাড়ির স্কেচ
    গাড়ির একটি খসড়া নকশা
    চূড়ান্ত কনসেপ্ট গাড়িটি দেখানো আউটপুট
    গাড়ির একটি পরিমার্জিত ছবি

    ৭. অক্ষরের সামঞ্জস্য: ৩৬০ ডিগ্রি দৃশ্য

    বারবার বিভিন্ন অ্যাঙ্গেলের জন্য অনুরোধ করে আপনি একটি চরিত্রের ৩৬০-ডিগ্রি ভিউ তৈরি করতে পারেন। সেরা ফলাফলের জন্য, সামঞ্জস্য বজায় রাখতে পরবর্তী অনুরোধগুলোতে পূর্বে তৈরি করা ছবিগুলো অন্তর্ভুক্ত করুন। জটিল ভঙ্গির ক্ষেত্রে, কাঙ্ক্ষিত ভঙ্গিটির একটি রেফারেন্স ছবি অন্তর্ভুক্ত করুন।

    টেমপ্লেট

    A studio portrait of [person] against [background], [looking forward/in profile looking right/etc.]
    

    প্রম্পট

    A studio portrait of this man against white, in profile looking right
    

    পাইথন

    from google import genai
    from google.genai import types
    from PIL import Image
    
    client = genai.Client()
    
    image_input = Image.open('/path/to/your/man_in_white_glasses.jpg')
    text_input = """A studio portrait of this man against white, in profile looking right"""
    
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[text_input, image_input],
    )
    
    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("man_right_profile.png")
    

    জাভাস্ক্রিপ্ট

    import { GoogleGenAI } from "@google/genai";
    import * as fs from "node:fs";
    
    async function main() {
    
      const ai = new GoogleGenAI({});
    
      const imagePath = "/path/to/your/man_in_white_glasses.jpg";
      const imageData = fs.readFileSync(imagePath);
      const base64Image = imageData.toString("base64");
    
      const prompt = [
        { text: "A studio portrait of this man against white, in profile looking right" },
        {
          inlineData: {
            mimeType: "image/jpeg",
            data: base64Image,
          },
        },
      ];
    
      const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
      });
      for (const part of response.candidates[0].content.parts) {
        if (part.text) {
          console.log(part.text);
        } else if (part.inlineData) {
          const imageData = part.inlineData.data;
          const buffer = Buffer.from(imageData, "base64");
          fs.writeFileSync("man_right_profile.png", buffer);
          console.log("Image saved as man_right_profile.png");
        }
      }
    }
    
    main();
    

    যান

    package main
    
    import (
      "context"
      "fmt"
      "log"
      "os"
      "google.golang.org/genai"
    )
    
    func main() {
    
      ctx := context.Background()
      client, err := genai.NewClient(ctx, nil)
      if err != nil {
          log.Fatal(err)
      }
    
      imagePath := "/path/to/your/man_in_white_glasses.jpg"
      imgData, _ := os.ReadFile(imagePath)
    
      parts := []*genai.Part{
        genai.NewPartFromText("A studio portrait of this man against white, in profile looking right"),
        &genai.Part{
          InlineData: &genai.Blob{
            MIMEType: "image/jpeg",
            Data:     imgData,
          },
        },
      }
    
      contents := []*genai.Content{
        genai.NewContentFromParts(parts, genai.RoleUser),
      }
    
      result, _ := client.Models.GenerateContent(
          ctx,
          "gemini-3.1-flash-image-preview",
          contents,
      )
    
      for _, part := range result.Candidates[0].Content.Parts {
          if part.Text != "" {
              fmt.Println(part.Text)
          } else if part.InlineData != nil {
              imageBytes := part.InlineData.Data
              outputFilename := "man_right_profile.png"
              _ = os.WriteFile(outputFilename, imageBytes, 0644)
          }
      }
    }
    

    জাভা

    import com.google.genai.Client;
    import com.google.genai.types.Content;
    import com.google.genai.types.GenerateContentConfig;
    import com.google.genai.types.GenerateContentResponse;
    import com.google.genai.types.Part;
    
    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    
    public class CharacterConsistency {
      public static void main(String[] args) throws IOException {
        try (Client client = new Client()) {
          GenerateContentConfig config = GenerateContentConfig.builder()
              .responseModalities("TEXT", "IMAGE")
              .build();
    
          GenerateContentResponse response = client.models.generateContent(
              "gemini-3.1-flash-image-preview",
              Content.fromParts(
                  Part.fromText("""
                      A studio portrait of this man against white, in profile looking right
                      """),
                  Part.fromBytes(
                      Files.readAllBytes(
                          Path.of("/path/to/your/man_in_white_glasses.jpg")),
                      "image/jpeg")),
              config);
    
          for (Part part : response.parts()) {
            if (part.text().isPresent()) {
              System.out.println(part.text().get());
            } else if (part.inlineData().isPresent()) {
              var blob = part.inlineData().get();
              if (blob.data().isPresent()) {
                Files.write(Paths.get("man_right_profile.png"), blob.data().get());
              }
            }
          }
        }
      }
    }
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
        -H "x-goog-api-key: $GEMINI_API_KEY" \
        -H 'Content-Type: application/json' \
        -d "{
          \"contents\": [{
            \"parts\":[
                {\"text\": \"A studio portrait of this man against white, in profile looking right\"},
                {
                  \"inline_data\": {
                    \"mime_type\":\"image/jpeg\",
                    \"data\": \"<BASE64_IMAGE_DATA>\"
                  }
                }
            ]
          }]
        }"
    

    ইনপুট

    আউটপুট ১

    আউটপুট ২

    সাদা চশমা পরা এক ব্যক্তির মূল ইনপুট
    মূল ছবি
    সাদা চশমা পরা একজন লোকের ডানদিকে তাকানোর আউটপুট
    সাদা চশমা পরা লোকটি ডানদিকে তাকাচ্ছে
    সাদা চশমা পরা এক ব্যক্তির সামনের দিকে তাকানোর আউটপুট
    সাদা চশমা পরা লোকটি সামনের দিকে তাকিয়ে আছে

    সর্বোত্তম অনুশীলন

    আপনার ফলাফলকে ভালো থেকে চমৎকার পর্যায়ে উন্নীত করতে, এই পেশাদার কৌশলগুলো আপনার কর্মপ্রবাহে অন্তর্ভুক্ত করুন।

    • অত্যন্ত সুনির্দিষ্ট হোন: আপনি যত বেশি বিবরণ দেবেন, আপনার নিয়ন্ত্রণ তত বেশি থাকবে। ‘কাল্পনিক বর্ম’ বলার পরিবর্তে এর বর্ণনা দিন: “রূপালী পাতার নকশায় খোদাই করা জমকালো এলভেন প্লেট আর্মার, যার একটি উঁচু কলার এবং বাজপাখির ডানার মতো আকৃতির কাঁধের বর্ম রয়েছে।”
    • প্রসঙ্গ ও উদ্দেশ্য প্রদান করুন: ছবিটির উদ্দেশ্য ব্যাখ্যা করুন। প্রসঙ্গ সম্পর্কে মডেলের ধারণা চূড়ান্ত ফলাফলের উপর প্রভাব ফেলবে। উদাহরণস্বরূপ, শুধু "একটি লোগো তৈরি করুন" বলার চেয়ে "একটি উচ্চমানের, মিনিমালিস্ট স্কিনকেয়ার ব্র্যান্ডের জন্য একটি লোগো তৈরি করুন" বললে ভালো ফল পাওয়া যাবে।
    • পুনরাবৃত্তি করুন এবং পরিমার্জন করুন: প্রথম চেষ্টাতেই নিখুঁত ছবি আশা করবেন না। মডেলের কথোপকথনমূলক স্বভাবকে কাজে লাগিয়ে ছোটখাটো পরিবর্তন আনুন। এরপর তাকে বলুন, "এটা দারুণ হয়েছে, কিন্তু আলোটা কি আরেকটু উষ্ণ করতে পারবেন?" অথবা "সবকিছু একই রাখুন, কিন্তু চরিত্রটির অভিব্যক্তি আরও গম্ভীর করুন।"
    • ধাপে ধাপে নির্দেশাবলী ব্যবহার করুন: অনেক উপাদান সহ জটিল দৃশ্যের জন্য, আপনার নির্দেশনাটিকে কয়েকটি ধাপে ভাগ করুন। "প্রথমে, ভোরের একটি শান্ত, কুয়াশাচ্ছন্ন বনের পটভূমি তৈরি করুন। তারপর, সম্মুখভাগে, শ্যাওলা-ঢাকা একটি প্রাচীন পাথরের বেদি যোগ করুন। সবশেষে, বেদিটির উপরে একটিমাত্র, উজ্জ্বল তরবারি রাখুন।"
    • ‘অর্থগত নেতিবাচক ইঙ্গিত’ ব্যবহার করুন: ‘কোনো গাড়ি নেই’ বলার পরিবর্তে, কাঙ্ক্ষিত দৃশ্যটি ইতিবাচকভাবে বর্ণনা করুন: ‘যানবাহনের কোনো চিহ্ন ছাড়া একটি খালি, জনশূন্য রাস্তা।’
    • ক্যামেরা নিয়ন্ত্রণ করুন: কম্পোজিশন নিয়ন্ত্রণে ফটোগ্রাফিক ও সিনেমাটিক পরিভাষা ব্যবহার করুন। যেমন— wide-angle shot , macro shot , low-angle perspective

    সীমাবদ্ধতা

    • সর্বোত্তম পারফরম্যান্সের জন্য, নিম্নলিখিত ভাষাগুলি ব্যবহার করুন: EN, ar-EG, de-DE, es-MX, fr-FR, hi-IN, id-ID, it-IT, ja-JP, ko-KR, pt-BR, ru-RU, ua-UA, vi-VN, zh-CN।
    • ছবি তৈরিতে অডিও বা ভিডিও ইনপুট সমর্থন করে না।
    • মডেলটি ব্যবহারকারীর স্পষ্টভাবে অনুরোধ করা সঠিক সংখ্যক ইমেজ আউটপুট সবসময় অনুসরণ করবে না।
    • gemini-2.5-flash-image ইনপুট হিসেবে সর্বোচ্চ ৩টি ছবির সাথে সবচেয়ে ভালোভাবে কাজ করে, যেখানে gemini-3-pro-image-preview উচ্চ বিশ্বস্ততার সাথে ৫টি ছবি এবং মোট ১৪টি পর্যন্ত ছবি সমর্থন করে। gemini-3.1-flash-image-preview একটি একক ওয়ার্কফ্লোতে সর্বোচ্চ ৪টি অক্ষরের সাদৃশ্য এবং সর্বোচ্চ ১০টি বস্তুর বিশ্বস্ততা সমর্থন করে।
    • কোনো ছবির জন্য টেক্সট তৈরি করার ক্ষেত্রে, জেমিনি সবচেয়ে ভালোভাবে কাজ করে যদি আপনি প্রথমে টেক্সটটি তৈরি করেন এবং তারপর সেই টেক্সটসহ একটি ছবির জন্য অনুরোধ করেন।
    • gemini-3.1-flash-image-preview Grounding with Google Search বর্তমানে ওয়েব সার্চ থেকে প্রাপ্ত বাস্তব মানুষের ছবি ব্যবহার সমর্থন করে না।
    • জেনারেট করা সমস্ত ছবিতে একটি SynthID ওয়াটারমার্ক অন্তর্ভুক্ত থাকে।

    ঐচ্ছিক কনফিগারেশন

    আপনি ঐচ্ছিকভাবে generate_content কলের config ফিল্ডে মডেলের আউটপুটের রেসপন্স মোডালিটি এবং অ্যাসপেক্ট রেশিও কনফিগার করতে পারেন।

    আউটপুট প্রকার

    মডেলটি ডিফল্টরূপে টেক্সট এবং ইমেজ রেসপন্স রিটার্ন করে (অর্থাৎ response_modalities=['Text', 'Image'] )। আপনি response_modalities=['Image'] ব্যবহার করে টেক্সট ছাড়া শুধু ইমেজ রিটার্ন করার জন্য রেসপন্সটি কনফিগার করতে পারেন।

    পাইথন

    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[prompt],
        config=types.GenerateContentConfig(
            response_modalities=['Image']
        )
    )
    

    জাভাস্ক্রিপ্ট

    const response = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
        config: {
            responseModalities: ['Image']
        }
      });
    

    যান

    result, _ := client.Models.GenerateContent(
        ctx,
        "gemini-3.1-flash-image-preview",
        genai.Text("Create a picture of a nano banana dish in a " +
                    " fancy restaurant with a Gemini theme"),
        &genai.GenerateContentConfig{
            ResponseModalities: "Image",
        },
      )
    

    জাভা

    response = client.models.generateContent(
        "gemini-3.1-flash-image-preview",
        prompt,
        GenerateContentConfig.builder()
            .responseModalities("IMAGE")
            .build());
    

    বিশ্রাম

    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "contents": [{
          "parts": [
            {"text": "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme"}
          ]
        }],
        "generationConfig": {
          "responseModalities": ["Image"]
        }
      }'
    

    অ্যাস্পেক্ট রেশিও এবং ছবির আকার

    মডেলটি ডিফল্টভাবে আউটপুট ছবির আকার আপনার ইনপুট ছবির আকারের সাথে মিলিয়ে দেয়, অথবা অন্যথায় ১:১ বর্গক্ষেত্র তৈরি করে। আপনি রেসপন্স রিকোয়েস্টের image_config এর অধীনে থাকা aspect_ratio ফিল্ডটি ব্যবহার করে আউটপুট ছবির অ্যাস্পেক্ট রেশিও নিয়ন্ত্রণ করতে পারেন, যা এখানে দেখানো হয়েছে:

    পাইথন

    # For gemini-2.5-flash-image
    response = client.models.generate_content(
        model="gemini-2.5-flash-image",
        contents=[prompt],
        config=types.GenerateContentConfig(
            image_config=types.ImageConfig(
                aspect_ratio="16:9",
            )
        )
    )
    
    # For gemini-3.1-flash-image-preview and gemini-3-pro-image-preview
    response = client.models.generate_content(
        model="gemini-3.1-flash-image-preview",
        contents=[prompt],
        config=types.GenerateContentConfig(
            image_config=types.ImageConfig(
                aspect_ratio="16:9",
                image_size="2K",
            )
        )
    )
    

    জাভাস্ক্রিপ্ট

    // For gemini-2.5-flash-image
    const response = await ai.models.generateContent({
        model: "gemini-2.5-flash-image",
        contents: prompt,
        config: {
          imageConfig: {
            aspectRatio: "16:9",
          },
        }
      });
    
    // For gemini-3.1-flash-image-preview and gemini-3-pro-image-preview
    const response_gemini3 = await ai.models.generateContent({
        model: "gemini-3.1-flash-image-preview",
        contents: prompt,
        config: {
          imageConfig: {
            aspectRatio: "16:9",
            imageSize: "2K",
          },
        }
      });
    

    যান

    // For gemini-2.5-flash-image
    result, _ := client.Models.GenerateContent(
        ctx,
        "gemini-2.5-flash-image",
        genai.Text("Create a picture of a nano banana dish in a " +
                    " fancy restaurant with a Gemini theme"),
        &genai.GenerateContentConfig{
            ImageConfig: &genai.ImageConfig{
              AspectRatio: "16:9",
            },
        }
      )
    
    // For gemini-3.1-flash-image-preview and gemini-3-pro-image-preview
    result_gemini3, _ := client.Models.GenerateContent(
        ctx,
        "gemini-3.1-flash-image-preview",
        genai.Text("Create a picture of a nano banana dish in a " +
                    " fancy restaurant with a Gemini theme"),
        &genai.GenerateContentConfig{
            ImageConfig: &genai.ImageConfig{
              AspectRatio: "16:9",
              ImageSize: "2K",
            },
        }
      )
    

    জাভা

    // For gemini-2.5-flash-image
    response = client.models.generateContent(
        "gemini-2.5-flash-image",
        prompt,
        GenerateContentConfig.builder()
            .imageConfig(ImageConfig.builder()
                .aspectRatio("16:9")
                .build())
            .build());
    
    // For gemini-3.1-flash-image-preview and gemini-3-pro-image-preview
    response_gemini3 = client.models.generateContent(
        "gemini-3.1-flash-image-preview",
        prompt,
        GenerateContentConfig.builder()
            .imageConfig(ImageConfig.builder()
                .aspectRatio("16:9")
                .imageSize("2K")
                .build())
            .build());
    

    বিশ্রাম

    # For gemini-2.5-flash-image
    curl -s -X POST \
      "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' \
      -d '{
        "contents": [{
          "parts": [
            {"text": "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme"}
          ]
        }],
        "generationConfig": {
          "imageConfig": {
            "aspectRatio": "16:9"
          }
        }
      }'
    
    # For gemini-3-pro-image-preview
    curl -s -X POST \
      "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
      -H "x-goog-api-key: $GEMINI_API_KEY" \
      -H 'Content-Type: application/json' \
      -d '{
        "contents": [{
          "parts": [
            {"text": "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme"}
          ]
        }],
        "generationConfig": {
          "imageConfig": {
            "aspectRatio": "16:9",
            "imageSize": "2K"
          }
        }
      }'
    

    উপলব্ধ বিভিন্ন অনুপাত এবং উৎপন্ন ছবির আকার নিম্নলিখিত সারণিগুলিতে তালিকাভুক্ত করা হয়েছে:

    ৩.১ ফ্ল্যাশ ইমেজ প্রিভিউ

    আকৃতির অনুপাত ৫১২ রেজোলিউশন ০.৫ হাজার টোকেন ১কে রেজোলিউশন ১ হাজার টোকেন ২কে রেজোলিউশন ২কে টোকেন ৪কে রেজোলিউশন ৪ হাজার টোকেন
    ১:১ ৫১২x৫১২ ৭৪৭ ১০২৪x১০২৪ ১১২০ ২০৪৮x২০৪৮ ১৬৮০ ৪০৯৬x৪০৯৬ ২৫২০
    ১:৪ ২৫৬x১০২৪ ৭৪৭ ৫১২x২০৪৮ ১১২০ ১০২৪x৪০৯৬ ১৬৮০ ২০৪৮x৮১৯২ ২৫২০
    ১:৮ ১৯২x১৫৩৬ ৭৪৭ ৩৮৪x৩০৭২ ১১২০ ৭৬৮x৬১৪৪ ১৬৮০ ১৫৩৬x১২২৮৮ ২৫২০
    ২:৩ ৪২৪x৬৩২ ৭৪৭ ৮৪৮x১২৬৪ ১১২০ ১৬৯৬x২৫২৮ ১৬৮০ ৩৩৯২x৫০৫৬ ২৫২০
    ৩:২ ৬৩২x৪২৪ ৭৪৭ ১২৬৪x৮৪৮ ১১২০ ২৫২৮x১৬৯৬ ১৬৮০ ৫০৫৬x৩৩৯২ ২৫২০
    ৩:৪ ৪৪৮x৬০০ ৭৪৭ ৮৯৬x১২০০ ১১২০ ১৭৯২x২৪০০ ১৬৮০ ৩৫৮৪x৪৮০০ ২৫২০
    ৪:১ ১০২৪x২৫৬ ৭৪৭ ২০৪৮x৫১২ ১১২০ ৪০৯৬x১০২৪ ১৬৮০ ৮১৯২x২০৪৮ ২৫২০
    ৪:৩ ৬০০x৪৪৮ ৭৪৭ ১২০০x৮৯৬ ১১২০ ২৪০০x১৭৯২ ১৬৮০ ৪৮০০x৩৫৮৪ ২৫২০
    ৪:৫ ৪৬৪x৫৭৬ ৭৪৭ ৯২৮x১১৫২ ১১২০ ১৮৫৬x২৩০৪ ১৬৮০ ৩৭১২x৪৬০৮ ২৫২০
    ৫:৪ ৫৭৬x৪৬৪ ৭৪৭ ১১৫২x৯২৮ ১১২০ ২৩০৪x১৮৫৬ ১৬৮০ ৪৬০৮x৩৭১২ ২৫২০
    ৮:১ ১৫৩৬x১৯২ ৭৪৭ ৩০৭২x৩৮৪ ১১২০ ৬১৪৪x৭৬৮ ১৬৮০ ১২২৮৮x১৫৩৬ ২৫২০
    ৯:১৬ ৩৮৪x৬৮৮ ৭৪৭ ৭৬৮x১৩৭৬ ১১২০ ১৫৩৬x২৭৫২ ১৬৮০ ৩০৭২x৫৫০৪ ২৫২০
    ১৬:৯ ৬৮৮x৩৮৪ ৭৪৭ ১৩৭৬x৭৬৮ ১১২০ ২৭৫২x১৫৩৬ ১৬৮০ ৫৫০৪x৩০৭২ ২৫২০
    ২১:৯ ৭৯২x১৬৮ ৭৪৭ ১৫৮৪x৬৭২ ১১২০ ৩১৬৮x১৩৪৪ ১৬৮০ ৬৩৩৬x২৬৮৮ ২৫২০

    ৩ প্রো ইমেজ প্রিভিউ

    আকৃতির অনুপাত ১কে রেজোলিউশন ১ হাজার টোকেন ২কে রেজোলিউশন ২কে টোকেন ৪কে রেজোলিউশন ৪ হাজার টোকেন
    ১:১ ১০২৪x১০২৪ ১১২০ ২০৪৮x২০৪৮ ১১২০ ৪০৯৬x৪০৯৬ ২০০০
    ২:৩ ৮৪৮x১২৬৪ ১১২০ ১৬৯৬x২৫২৮ ১১২০ ৩৩৯২x৫০৫৬ ২০০০
    ৩:২ ১২৬৪x৮৪৮ ১১২০ ২৫২৮x১৬৯৬ ১১২০ ৫০৫৬x৩৩৯২ ২০০০
    ৩:৪ ৮৯৬x১২০০ ১১২০ ১৭৯২x২৪০০ ১১২০ ৩৫৮৪x৪৮০০ ২০০০
    ৪:৩ ১২০০x৮৯৬ ১১২০ ২৪০০x১৭৯২ ১১২০ ৪৮০০x৩৫৮৪ ২০০০
    ৪:৫ ৯২৮x১১৫২ ১১২০ ১৮৫৬x২৩০৪ ১১২০ ৩৭১২x৪৬০৮ ২০০০
    ৫:৪ ১১৫২x৯২৮ ১১২০ ২৩০৪x১৮৫৬ ১১২০ ৪৬০৮x৩৭১২ ২০০০
    ৯:১৬ ৭৬৮x১৩৭৬ ১১২০ ১৫৩৬x২৭৫২ ১১২০ ৩০৭২x৫৫০৪ ২০০০
    ১৬:৯ ১৩৭৬x৭৬৮ ১১২০ ২৭৫২x১৫৩৬ ১১২০ ৫৫০৪x৩০৭২ ২০০০
    ২১:৯ ১৫৮৪x৬৭২ ১১২০ ৩১৬৮x১৩৪৪ ১১২০ ৬৩৩৬x২৬৮৮ ২০০০

    জেমিনি ২.৫ ফ্ল্যাশ ইমেজ

    আকৃতির অনুপাত সমাধান টোকেন
    ১:১ ১০২৪x১০২৪ ১২৯০
    ২:৩ ৮৩২x১২৪৮ ১২৯০
    ৩:২ ১২৪৮x৮৩২ ১২৯০
    ৩:৪ ৮৬৪x১১৮৪ ১২৯০
    ৪:৩ ১১৮৪x৮৬৪ ১২৯০
    ৪:৫ ৮৯৬x১১৫২ ১২৯০
    ৫:৪ ১১৫২x৮৯৬ ১২৯০
    ৯:১৬ ৭৬৮x১৩৪৪ ১২৯০
    ১৬:৯ ১৩৪৪x৭৬৮ ১২৯০
    ২১:৯ ১৫৩৬x৬৭২ ১২৯০

    মডেল নির্বাচন

    আপনার নির্দিষ্ট ব্যবহারের জন্য সবচেয়ে উপযুক্ত মডেলটি বেছে নিন।

    • জেমিনি ৩.১ ফ্ল্যাশ ইমেজ প্রিভিউ (ন্যানো ব্যানানা ২ প্রিভিউ) আপনার ইমেজ তৈরির জন্য সেরা মডেল হওয়া উচিত, কারণ এটি খরচ ও ল্যাটেন্সির তুলনায় সার্বিকভাবে সেরা পারফরম্যান্স এবং ইন্টেলিজেন্স প্রদান করে। আরও বিস্তারিত জানতে মডেলটির মূল্য এবং সক্ষমতা পেজটি দেখুন।

    • জেমিনি ৩ প্রো ইমেজ প্রিভিউ (ন্যানো ব্যানানা প্রো প্রিভিউ) পেশাদার অ্যাসেট প্রোডাকশন এবং জটিল নির্দেশাবলীর জন্য ডিজাইন করা হয়েছে। এই মডেলে গুগল সার্চ ব্যবহার করে বাস্তব জগতের উপর ভিত্তি করে কাজ করার সুবিধা, একটি ডিফল্ট "থিংকিং" প্রক্রিয়া রয়েছে যা ছবি তৈরির আগে কম্পোজিশনকে আরও উন্নত করে, এবং এটি ৪কে রেজোলিউশন পর্যন্ত ছবি তৈরি করতে পারে। আরও বিস্তারিত জানতে মডেলটির মূল্য এবং সক্ষমতা পেজটি দেখুন।

    • জেমিনি ২.৫ ফ্ল্যাশ ইমেজ (ন্যানো ব্যানানা) গতি এবং দক্ষতার জন্য ডিজাইন করা হয়েছে। এই মডেলটি অধিক পরিমাণে ও কম ল্যাটেন্সির কাজের জন্য অপ্টিমাইজ করা হয়েছে এবং এটি ১০২৪ পিক্সেল রেজোলিউশনে ছবি তৈরি করে। আরও বিস্তারিত জানতে মডেলটির মূল্য এবং সক্ষমতা পেজটি দেখুন।

    কখন ইমাজেন ব্যবহার করবেন

    জেমিনির অন্তর্নির্মিত ছবি তৈরির সক্ষমতা ব্যবহারের পাশাপাশি, আপনি জেমিনি এপিআই (Gemini API)-এর মাধ্যমে আমাদের বিশেষায়িত ছবি তৈরির মডেল ‘ইমাজেন’ (Imagen) -ও অ্যাক্সেস করতে পারবেন।

    Imagen দিয়ে ছবি তৈরি করা শুরু করার জন্য Imagen 4 মডেলটিই আপনার প্রথম পছন্দ হওয়া উচিত। উন্নত ব্যবহারের জন্য অথবা যখন আপনার সেরা ছবির গুণমান প্রয়োজন, তখন Imagen 4 Ultra বেছে নিন (মনে রাখবেন, এটি দিয়ে একবারে কেবল একটি ছবিই তৈরি করা যায়)।

    এরপর কী?

    • কুকবুক গাইডে আরও উদাহরণ এবং কোড নমুনা খুঁজুন।
    • জেমিনি এপিআই ব্যবহার করে কীভাবে ভিডিও তৈরি করতে হয়, তা জানতে ভিও গাইডটি দেখুন।
    • জেমিনি মডেল সম্পর্কে আরও জানতে, জেমিনি মডেল দেখুন।