{"slug": "imagen-3-4-shut-down-june-24-migrate-to-gemini-image-2026", "title": "Imagen 3 & 4 Shut Down June 24: Migrate to Gemini Image (2026)", "summary": "Google is shutting down all Imagen models on Firebase AI Logic on June 24, 2026, and on Vertex AI on August 17, 2026, requiring developers to migrate to the Gemini Image model (gemini-2.5-flash-image). The migration involves renaming the API method from generate_images to generate_content, updating the model identifier, and restructuring the response, with mask-based editing (inpainting, outpainting, object removal) having no replacement and a separate deadline of June 30, 2026.", "body_md": "June 24, 2026. That is the shutdown date for every Imagen model on Firebase AI Logic — `imagen-3.0-generate-002`\n\n, `imagen-4.0-generate-001`\n\n, `imagen-4.0-ultra-generate-001`\n\n, `imagen-4.0-fast-generate-001`\n\n. All of them. If you have been putting off this migration, you have run out of runway.\n\nThe replacement is Google's Gemini Image models — internally called \"Nano Banana,\" publicly named `gemini-2.5-flash-image`\n\n. The migration is mostly a one-function rename and a response structure update, around 90 minutes of work for most codebases. The catch: one Imagen capability, mask-based editing, has no replacement at all. That separate deadline hits June 30.\n\nFirebase AI Logic's migration documentation confirms these shutdown dates:\n\n**imagen-3.0-generate-002** — June 24, 2026\n\n**imagen-4.0-generate-001** — June 24, 2026\n\n**imagen-4.0-ultra-generate-001** — June 24, 2026\n\n**imagen-4.0-fast-generate-001** — June 24, 2026\n\n**imagen-3.0-capability-001** (mask editing: inpainting, outpainting, object removal) — June 30, 2026\n\nVertex AI runs on a slightly different clock — Google recommends migrating before June 30, with a hard shutdown date of August 17 for Vertex AI users on legacy Imagen endpoints. Firebase AI Logic is the shorter deadline. Don't assume extra time if your app uses the Firebase SDK.\n\nThree things change simultaneously: the method name, the model identifier, and the response structure. All three break if you miss any one of them.\n\n**Before (Imagen):**\n\n``` python\nimport google.generativeai as genai\n\nclient = genai.Client(api_key=\"YOUR_KEY\")\n\nresponse = client.models.generate_images(\n    model=\"imagen-4.0-generate-001\",\n    prompt=\"A red fox running through snow\",\n    config={\"number_of_images\": 1, \"output_mime_type\": \"image/jpeg\"}\n)\n\nimage_bytes = response.generated_images[0].image.image_bytes\n```\n\n**After (Gemini Image):**\n\n``` python\nimport google.generativeai as genai\n\nclient = genai.Client(api_key=\"YOUR_KEY\")\n\nresponse = client.models.generate_content(\n    model=\"gemini-2.5-flash-image\",\n    contents=\"A red fox running through snow\"\n)\n\nimage_bytes = response.candidates[0].content.parts[0].inline_data.data\n```\n\n`generate_images`\n\nbecomes `generate_content`\n\n. The response path shifts from `.generated_images[0].image.image_bytes`\n\nto `.candidates[0].content.parts[0].inline_data.data`\n\n. The `config`\n\ndict drops entirely — `gemini-2.5-flash-image`\n\ndoes not accept `number_of_images`\n\nas a parameter. If you need multiple images, call the API multiple times.\n\nThe response structure change is where most migration bugs land. Imagen returned a typed `ImageGenerationResponse`\n\nwith a strongly-typed `.images`\n\narray. Gemini Image returns a `GenerateContentResponse`\n\nwith a mixed `.parts`\n\narray. If your call generates both text and an image in the same response (Gemini Image supports this; Imagen did not), you cannot reliably grab index 0 — you need to filter `parts`\n\nby type.\n\n``` js\n// Before\nconst response = await ai.models.generateImages({\n  model: 'imagen-4.0-generate-001',\n  prompt: 'A red fox running through snow',\n  config: { numberOfImages: 1, outputMimeType: 'image/jpeg' }\n});\nconst imageBytes = response.generatedImages[0].image.imageBytes;\n\n// After\nconst response = await ai.models.generateContent({\n  model: 'gemini-2.5-flash-image',\n  contents: 'A red fox running through snow'\n});\nconst imageBytes = response.candidates[0].content.parts[0].inlineData.data;\n```\n\nSame pattern: method rename, model name, response path. The camelCase shifts to match — `inlineData`\n\nrather than `inline_data`\n\nin the JavaScript SDK. Watch for that.\n\nMobile developers using Firebase AI Logic have platform-specific SDK changes on top of the model swap.\n\n**Swift — Before:**\n\n``` js\nlet imagenModel = FirebaseAI.imagenModel(modelName: \"imagen-4.0-generate-001\")\nlet response = try await imagenModel.generateImages(from: \"A red fox in snow\")\nlet imageData = response.images.first?.data\n```\n\n**Swift — After:**\n\n``` js\nlet geminiModel = FirebaseAI.generativeModel(modelName: \"gemini-2.5-flash-image\")\nlet response = try await geminiModel.generateContent(\"A red fox in snow\")\nlet imageData = response.candidates.first?.content.parts\n    .compactMap { $0 as? InlineDataPart }\n    .first?.data\n```\n\n**Kotlin — Before:**\n\n```\nval imagenModel = Firebase.ai.imagenModel(\"imagen-4.0-generate-001\")\nval response = imagenModel.generateImages(\"A red fox in snow\")\nval imageData = response.images.firstOrNull()?.data\n```\n\n**Kotlin — After:**\n\n```\nval geminiModel = Firebase.ai.generativeModel(\"gemini-2.5-flash-image\")\nval response = geminiModel.generateContent(\"A red fox in snow\")\nval imageData = response.candidates.firstOrNull()?.content?.parts\n    ?.filterIsInstance()\n    ?.firstOrNull()?.inlineData?.data\n```\n\nThe Swift version uses `.compactMap { $0 as? InlineDataPart }`\n\nto filter the parts array. Kotlin uses `filterIsInstance<InlineDataPart>()`\n\n. Both are more verbose than the old `response.images.first`\n\n, but both handle the mixed-parts response correctly regardless of whether the model returns text alongside the image.\n\n`imagen-3.0-capability-001`\n\nhandles mask-based editing — inpainting (fill a masked region with generated content), outpainting (extend the canvas beyond its borders), and object removal (fill with background). Its shutdown date is June 30, not June 24. That is not extra time; it is a separate deadline for a separate endpoint being retired without a direct replacement.\n\nGoogle's DevRel team confirmed this in a developer forum thread on June 18 with 147 replies. The frustration was pointed: developers using Imagen mask editing for product photo cleanup, e-commerce background removal, and virtual try-on have no equivalent Gemini Image API call. The recommended path from the Google team was to migrate core generation to `gemini-2.5-flash-image`\n\nnow, and handle the mask editing gap via third-party services until Google ships a native solution — with no ETA given.\n\nIf mask editing is a peripheral feature in your app, stub it out with an error message and plan a replacement later. If mask editing is central to your product value, you need a fallback before June 30. Stability AI's SDXL inpainting API accepts similar mask formats. Replicate hosts several inpainting models at comparable quality levels. Cloudflare Workers AI includes a Stable Diffusion inpainting endpoint that skips GPU infrastructure management entirely. None of these are drop-in replacements, but all expose mask-based editing that won't disappear on you in eight days.\n\nThe API is not the only thing that changes. Run your existing prompt library through Gemini Image before cutting prod traffic over.\n\n**Aspect ratios.** Imagen 4 accepted explicit parameters: 1:1, 4:3, 3:4, 16:9, 9:16. Gemini Image defaults to 1:1 and reads aspect ratio guidance from the prompt itself. For landscape or portrait outputs, add directional language — \"horizontal landscape image\" or \"vertical portrait format\" — directly in the prompt. Missing this is the most common migration regression reported in the Google developer forums.\n\n**Text rendering.** Imagen 4.0-ultra was the benchmark for readable text within generated images. Gemini Image handles text better than Imagen 3 did, but trails 4.0-ultra on multi-word phrases, sub-12px apparent font sizes, and text on complex backgrounds. If your prompts include specific text strings like business cards, labels, or signage, benchmark explicitly before launch.\n\n**Safety filtering.** Gemini Image runs Gemini's content safety system, which is more conservative than Imagen's on ambiguous content. Prompts involving artistic violence, medical imagery, or certain cultural content that Imagen processed without intervention may now return refusals. Run your full prompt corpus through Google AI Studio — free tier handles this — and note which prompts need adjustment before touching production code.\n\n**SynthID watermarks.** Both Imagen and Gemini Image embed SynthID digital watermarks. The implementations differ in their metadata format. If your pipeline reads, strips, or validates SynthID data, test that code path against Gemini Image outputs specifically.\n\n**Price per image.** Imagen used flat per-image pricing. Gemini Image on Vertex AI bills per output token — a typical 1024×1024 JPEG runs 400–600 image output tokens. At current Vertex AI rates, that lands higher than Imagen's standard tier for most workloads. Run cost projections against your actual usage before cutting over if you generate at volume.\n\nVertex AI users have a slightly different SDK path. The old Imagen endpoint was `imagegeneration@006`\n\nunder the Vision Models library. The replacement uses the Generative Models SDK:\n\n``` python\nfrom vertexai.generative_models import GenerativeModel\n\n# Before\nfrom vertexai.preview.vision_models import ImageGenerationModel\nmodel = ImageGenerationModel.from_pretrained(\"imagegeneration@006\")\nresponse = model.generate_images(prompt=\"A red fox in snow\")\nimage = response.images[0]\n\n# After\nmodel = GenerativeModel(\"gemini-2.5-flash-image\")\nresponse = model.generate_content(\"A red fox in snow\")\nimage_data = response.candidates[0].content.parts[0].inline_data.data\n```\n\nCheck your Vertex AI quota for `gemini-2.5-flash-image`\n\nbefore migration. The default is 60 requests per minute per region — separate from text model quotas and separate from the old Imagen quotas. If you are running at any meaningful volume, file a quota increase request through Google Cloud Console today. Standard processing is 24–48 hours, and the buffer before Vertex AI shutdown on August 17 disappears faster than it looks.\n\nGrep the codebase for `imagenModel`\n\n, `generate_images`\n\n, `generateImages`\n\n, `imagegeneration@`\n\n, and every Imagen model name string. One pass surfaces every file that needs updating.\n\nRun your 20 most-used prompts through `gemini-2.5-flash-image`\n\nin Google AI Studio (free tier). Document output differences — especially aspect ratios and text rendering. Adjust prompts before touching code.\n\nUpdate method names, model identifiers, and response parsing paths in a feature branch. The code changes are mechanical; the response structure update is where bugs hide.\n\nCheck Vertex AI quota for `gemini-2.5-flash-image`\n\nand request an increase if needed.\n\nIf the app uses mask-based editing: stand up a third-party fallback before June 30. This takes longer than the core migration — start it today.\n\nDeploy to staging, run the full test suite. Snapshot tests will need to be reset — model outputs differ.\n\nCut Firebase production traffic to Gemini Image by June 24. Keep the old Imagen code paths behind a feature flag for one week as a rollback target.\n\n*Originally published at wowhow.cloud*", "url": "https://wpnews.pro/news/imagen-3-4-shut-down-june-24-migrate-to-gemini-image-2026", "canonical_source": "https://dev.to/akaranjkar08/imagen-3-4-shut-down-june-24-migrate-to-gemini-image-2026-1h87", "published_at": "2026-06-22 00:23:41+00:00", "updated_at": "2026-06-22 01:10:17.487330+00:00", "lang": "en", "topics": ["artificial-intelligence", "generative-ai", "developer-tools", "ai-products", "ai-infrastructure"], "entities": ["Google", "Firebase AI Logic", "Vertex AI", "Imagen", "Gemini Image", "gemini-2.5-flash-image", "Nano Banana"], "alternates": {"html": "https://wpnews.pro/news/imagen-3-4-shut-down-june-24-migrate-to-gemini-image-2026", "markdown": "https://wpnews.pro/news/imagen-3-4-shut-down-june-24-migrate-to-gemini-image-2026.md", "text": "https://wpnews.pro/news/imagen-3-4-shut-down-june-24-migrate-to-gemini-image-2026.txt", "jsonld": "https://wpnews.pro/news/imagen-3-4-shut-down-june-24-migrate-to-gemini-image-2026.jsonld"}}