Image editing (text-and-image-to-image)

A shared folder with AI prompts and code snippets

From workspace: Google Gemini

Team: Nano Banana

Total snippets: 3

Google Gemini

Image editing (text-and-image-to-image)

3 snippets

Image editing (text-and-image-to-image) Go

package main import ( "context" "fmt" "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" ...

Image editing (text-and-image-to-image) JavaScript

import { GoogleGenAI, Modality } 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...

Image editing (text-and-image-to-image) python

The following example demonstrates uploading base64 encoded images. For multiple images, larger payloads, and supported MIME types, check the Image understanding page.

from google import genai from google.genai import types from PIL import Image from io import BytesIO client = genai.Client() prompt = ( "Create a picture of my cat eating a nano-banana in a " "fancy restaurant under the Gemini...