Image & Video Generation
Image & Video Generation on Google Cloud covers generating, editing, upscaling, evaluating, and operationalizing visual media with Gemini image models, Imagen, Veo, Virtual Try-On, Vertex AI evaluation, and deployable open models. The area combines multimodal prompting, reference assets, Cloud Storage inputs and outputs, long-running generation operations, and quality evaluation workflows.
Synthesized across 18 notebooks. See the source pages under Notebooks below for line-level grounding.
The notebooks show two main production paths: managed Google models through the Google Gen AI SDK on Agent Platform or Vertex AI, and open-model deployment through Vertex AI Model Garden. Gemini image models are used for image generation, image editing, grounding, visual object detection, structured parsing, and reference-driven creative workflows; Imagen focuses on image generation, editing, and upscaling; Veo handles text-to-video, image-to-video, reference-to-video, frame interpolation, and video extension.
Most workflows depend on explicit project, location, authentication, and API setup. Image outputs usually require IMAGE in response_modalities, media inputs are passed as bytes or Cloud Storage URIs, and larger video outputs are commonly written to Cloud Storage. Many examples use global location for Gemini preview/image models, while Imagen, Veo, and Virtual Try-On commonly default to us-central1 when GOOGLE_CLOUD_REGION is unset.
Quality work is not limited to generation. Gecko-based evaluation notebooks generate prompt-specific rubrics, validate generated questions through VQA-style checks, compare positive examples with counterexamples, and aggregate per-question results into final scores. Production-grade use also requires quota awareness, cost review, cleanup of deployed endpoints, and inspection of generated media before reuse.
Canonical workflow
- Enable the required Google Cloud APIs, set PROJECT_ID and LOCATION or environment variables, and authenticate the notebook or runtime.
- Choose the appropriate model family: Gemini image models for multimodal image generation and editing, Imagen for image editing and upscaling, Veo for video generation and extension, Virtual Try-On for apparel try-on, or Model Garden for deployable open models.
- Prepare inputs as structured prompts plus local files, Part.from_bytes, Image.from_file, Cloud Storage URIs, reference images, masks, or structured schemas as required by the workflow.
- Configure generation explicitly, including response_modalities, ImageConfig or GenerateImagesConfig, aspect ratio, image size, number of images or videos, safety settings, person_generation, audio generation, output MIME type, and Cloud Storage output paths.
- Run generation or editing, then check candidates, finish_reason, thought parts, inline image data, or long-running operation status before reading or displaying results.
- Inspect outputs visually, compare originals and edits side by side when relevant, decode base64 endpoint responses when using deployed open models, and save intermediate assets when they will be reused.
- For evaluation, generate prompt-specific Gecko rubrics, inspect generated questions and validator reliability, add manual questions when needed, and aggregate validation results into final scores.
- Clean up billable resources such as deployed endpoints, uploaded models, Gradio apps, and generated output locations when the workflow is complete.
Best practices
See Image & Video Generation - Best Practices for the full distilled guide.
- Set project, region, and credentials through environment variables, Colab Secrets, or platform defaults instead of hardcoding runtime configuration.
- Enable the required API before running notebooks: Agent Platform or Vertex AI for managed model workflows, plus Artifact Registry when deploying Hugging Face container models.
- Use explicit generation configuration rather than relying on defaults: response_modalities, image_config, aspect_ratio, image size, output_mime_type, number_of_images, number_of_videos, duration_seconds, resolution, safety_filter_level, person_generation, and generate_audio where applicable.
- Always check response candidates, finish_reason, inline image data, thought parts, generated_videos, or operation status before assuming media was produced.
- Use Part.from_bytes or Image.from_file for local media and Part.from_uri or gcs_uri Image objects for Cloud Storage or remote media inputs; specify mime_type for Cloud Storage image and video URIs.
- Use Cloud Storage output paths for larger generated videos, video extension outputs, or persistent generated assets.
Key models & APIs
- Google Gen AI SDK (google-genai), google-cloud-aiplatform and google-cloud-aiplatform[evaluation]>=1.122.0, Vertex AI API, Agent Platform API at aiplatform.googleapis.com, Vertex AI Gecko predefined image and video evaluation rubrics, Vertex AI Model Garden SDK, Gemini image models: gemini-2.5-flash-image, gemini-2.5-flash-image-preview, gemini-3.1-flash-image, gemini-3-pro-image, Gemini multimodal and prompt-helper models: gemini-2.5-flash, gemini-2.5-pro, gemini-2.0-flash, gemini-3.5-flash, gemini-3.1-pro-preview, Imagen models: imagen-3.0-generate-002, imagen-3.0-capability-001, imagen-4.0-generate-001, imagen-4.0-upscale-preview, Veo models: veo-3.1-generate-001, veo-3.1-generate-preview, veo-3.1-fast-generate-001, veo-3.1-fast-generate-preview, veo-3.1-lite-generate-001, Virtual Try-On model: virtual-try-on-001, Open models in Model Garden examples: black-forest-labs/FLUX.1-dev, stabilityai/stable-diffusion-xl-base-1.0, Google Search grounding tools for Gemini image generation workflows, Cloud Storage gs:// media inputs and output_gcs_uri or output_gcs paths
Notebooks (18)
Gemini (9)
- Evaluate images with Gecko — Evaluates prompt-image alignment with Gecko-style rubric generation and VQA validation in Vertex AI.
- Evaluate images with predefined Gecko — Evaluates text-to-image outputs with Vertex AI predefined Gecko image rubrics.
- Evaluate videos with predefined Gecko — Evaluates generated videos with Vertex AI Gecko text-to-video rubrics.
- Gemini 2.5 Flash Image (Nano Banana 🍌) Generation — Generates and edits images with Gemini 2.5 Flash Image using the Google Gen AI SDK on Agent Platform.
- Gemini 3.1 Flash Image (Nano Banana 2 🍌) Generation — Shows Gemini 3.1 Flash Image generation, grounding, video input, and image editing with Google Gen AI SDK.
- Gemini 3 Pro Image (Nano Banana Pro 🍌) Generation — Shows how to generate and edit images with Gemini 3 Pro Image using the Google GenAI SDK.
- Nano Banana 🍌: Gemini 2.5 Flash Image Recipes — Demonstrates Gemini 2.5 Flash image generation and editing recipes on Vertex AI with google-genai.
- Generating Consistent Imagery with Gemini 🍌 — Generates a consistent robot image story from one archive image using Gemini 2.5 Flash Image.
- Detecting and Editing Visual Objects with Gemini — Detects visual objects with Gemini, crops them, and edits them with Gemini image models.
Open Models (2)
- Get started with Vertex AI Model Garden SDK — Deploy and test open models on Vertex AI with the Model Garden SDK.
- Guess who or what app using Hugging Face Deep Learning container model on Vertex AI — Builds a Gradio riddle game using Gemini and a Hugging Face FLUX model deployed on Vertex AI.
Vision (7)
- Imagen 3 Image Editing — Edits images with Imagen 3 using inpainting, background swap, outpainting, and mask-free prompts.
- Imagen 4 Image Upscale — Shows how to upscale generated, local, and Cloud Storage images with Imagen 4 using google-genai.
- Veo 3.1 Advanced Controls — Shows Veo 3.1 frame interpolation and video extension with Google Gen AI SDK on Agent Platform.
- Veo 3.1 Reference to Video — Generates Veo 3.1 videos from reference images using the Google Gen AI SDK.
- Veo 3.1 Video Generation — Generates Veo 3.1 videos from text and images with optional Gemini prompt optimization.
- Virtual Try-On: Image Generation — Uses Google Gen AI SDK to generate virtual try-on images from local and Cloud Storage clothing images.
- Virtual Try-On: Batch Generation Pipeline — Batch-generates virtual try-on images from person and apparel inputs using Google GenAI SDK.
Related concepts
- Vision · Getting Started · Gemini Capabilities · Evaluation · RAG & Grounding · Applied Use Cases · Open & Partner Models · Prompt Engineering
Part of the Generative AI Google Brain · Image & Video Generation - Best Practices