
Including customized photos to your app can considerably enhance and personalize consumer expertise and enhance consumer engagement. This put up explores two new capabilities for picture era with Firebase AI Logic: the specialised Imagen enhancing options, at present in preview, and the overall availability of Gemini 2.5 Flash Picture (a.ok.a “Nano Banana”), designed for contextual or conversational picture era.
Enhance consumer engagement with photos generated by way of Firebase AI Logic
Picture era fashions can be utilized to create customized consumer profile avatars or to combine personalised visible property straight into key display screen flows.
For instance, Imagen presents new enhancing options (in developer preview). Now you can draw a masks and make the most of inpainting to generate pixels inside the masked space. Moreover, outpainting is obtainable to generate pixels exterior the masks.

Imagen helps inpainting, letting generate solely part of a picture.
Alternatively, Gemini 2.5 Flash Picture (a.ok.a Nano Banana), can use prolonged world information and the reasoning capabilities of the Gemini fashions to generate contextually related photos, which is good for creating dynamic illustrations that align with a consumer’s present in-app expertise.
Use Gemini 2.5 Flash Picture to create dynamic illustrations contextually related to your app.
Lastly, the flexibility to conversationally and iteratively edit photos enable customers to edit a photograph utilizing pure language.

Use Gemini 2.5 Flash Picture to edit an image utilizing pure language.
When beginning to combine AI to your utility, you will need to find out about AI security. It’s significantly key to evaluate your utility’s safety dangers, take into account changes to mitigate security dangers, carry out security testing acceptable to your use case and solicit consumer suggestions and monitor content material.
Imagen or Gemini: The selection is yours
The distinction between Gemini 2.5 Flash Picture (“Nano Banana”) and Imagen lies of their main focus and superior capabilities. Gemini 2.5 Flash Picture, as a picture mannequin inside the bigger Gemini household, excels in conversational picture enhancing, sustaining context and topic consistency throughout a number of iterations, and leveraging “world information and reasoning” to create contextually related visuals or embed correct visuals inside lengthy textual content sequences.
Imagen is Google’s specialised picture era mannequin, designed for larger artistic management, specializing in extremely photorealistic outputs, creative element, particular types, and offering specific controls for specifying the side ratio or format of the generated picture.
Gemini 2.5 Flash Photos | Imagen |
🌎 world information and reasoning for extra contextually related photos
💬 edit photos conversationally whereas sustaining context
📖 embed correct visuals inside lengthy textual content sequences | 📐 specify the side ratio or format of generated photos
🖌️Help of mask-based enhancing for in-painting and out-painting.
🎚️ larger management over particulars of the generated picture (high quality, creative element and particular types) |
Let’s see how one can use them in your app.
Inpainting with Imagen
Just a few months in the past, we launched new enhancing options for Imagen. Though Imagen is now prepared for manufacturing for picture era, enhancing options are nonetheless in developer preview.
Imagen enhancing options embody inpainting and outpainting, mask-based picture enhancing options. This new functionality permits customers to switch particular areas of a picture with out regenerating the whole image. This implies you may protect the very best elements of your picture and solely alter what you want to change.
Use Imagen enhancing options to make exact focused adjustments in a picture and guaranteeing the remainder of the picture integrityThese adjustments are made whereas sustaining the core components and general integrity of the unique picture and modifying solely the world within the masks.
To implement inpainting with Imagen, first initialize imagen-3.0-capability-001 a particular Imagen mannequin supporting enhancing options:
// Copyright 2025 Google LLC.
// SPDX-License-Identifier: Apache-2.0
val editingModel =
Firebase.ai(backend = GenerativeBackend.vertexAI()).imagenModel(
"imagen-3.0-capability-001",
generationConfig = ImagenGenerationConfig(
numberOfImages = 1,
aspectRatio = ImagenAspectRatio.SQUARE_1x1,
imageFormat = ImagenImageFormat.jpeg(compressionQuality = 75),
),
)
From there, outline the inpainting perform:
// Copyright 2025 Google LLC.
// SPDX-License-Identifier: Apache-2.0
val immediate = "take away the pancakes and make it an omelet as an alternative"
droop enjoyable inpaintImageWithMask(sourceImage: Bitmap, maskImage: Bitmap, immediate: String, editSteps: Int = 50): Bitmap {
val imageResponse = editingModel.editImage(
referenceImages = listOf(
ImagenRawImage(sourceImage.toImagenInlineImage()),
ImagenRawMask(maskImage.toImagenInlineImage()),
),
immediate = immediate,
config = ImagenEditingConfig(
editMode = ImagenEditMode.INPAINT_INSERTION,
editSteps = editSteps,
),
)
return imageResponse.photos.first().asBitmap()
}You present each a sourceImage, a maskImage and a immediate for the edit and the variety of edit steps to be carried out.
You possibly can see it in motion within the Imagen Enhancing Pattern within the Android AI Pattern catalog!
And Imagen additionally helps outpainting that lets you let the mannequin generate the pixels exterior of a masks. You too can use Imagen’s Picture customization capabilities to vary the type of an image or replace a topic in an image. Learn extra about it within the Android developer documentation.
Conversational picture era with Gemini 2.5 Flash Picture
One option to edit photos with Gemini 2.5 Flash Picture is to make use of the mannequin’s multi-turn chat capabilities.
First, initialize the mannequin:
// Copyright 2025 Google LLC.
// SPDX-License-Identifier: Apache-2.0
val mannequin = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
modelName = "gemini-2.5-flash-image",
// Configure the mannequin to reply with textual content and pictures (required)
generationConfig = generationConfig {
responseModalities = listOf(ResponseModality.TEXT,
ResponseModality.IMAGE)
}
)
To realize an identical end result to the mask-based Imagen technique described above, we will make the most of the chat API to provoke a dialog with Gemini 2.5 Flash Picture.
// Copyright 2025 Google LLC.
// SPDX-License-Identifier: Apache-2.0
// Initialize the chat
val chat = mannequin.startChat()
// Load a bitmap
val supply = ImageDecoder.createSource(context.contentResolver, uri)
val bitmap = ImageDecoder.decodeBitmap(supply)
// Create the preliminary immediate instructing the mannequin to edit the picture
val immediate = content material {
picture(bitmap)
textual content("take away the pancakes and add an omelet")
}
// To generate an preliminary response, ship a consumer message with the picture and textual content immediate
var response = chat.sendMessage(immediate)
// Examine the returned picture
var generatedImageAsBitmap = response
.candidates.first().content material.elements.filterIsInstance<ImagePart>().firstOrNull()?.picture
// Comply with up requests don't have to specify the picture once more
response = chat.sendMessage("Now, heart the omelet within the pan")
generatedImageAsBitmap = response
.candidates.first().content material.elements.filterIsInstance<ImagePart>().firstOrNull()?.picture
You possibly can see it in motion within the Gemini Picture Chat pattern within the Android AI Pattern catalog and skim extra about it within the Android documentation.
Conclusion
Each Imagen and Gemini 2.5 Flash Picture provide highly effective capabilities, permitting you to pick out the perfect picture era mannequin to personalize your app and enhance consumer engagement, relying in your particular use case.
