Generate stunning visuals in your Android apps with Imagen 3 via Vertex AI in Firebase



Posted by
Imagen 3, our most advanced image generation model, is now available through Vertex AI in Firebase, making it even easier to integrate it to your Android apps.
Designed to generate well-composed images with exceptional details, reduced artifacts, and rich lighting, Imagen 3 represents a significant leap forward in image generation capabilities.


Imagen 3 unlocks exciting new possibilities for Android developers. Generated visuals can adapt to the content of your app, creating a more engaging user experience. For instance, your users can generate custom artwork to enhance their in-app profile. Imagen can also improve your app’s storytelling by bringing its narratives to life with delightful personalized illustrations.
You can experiment with image prompts in Vertex AI Studio, and learn how to improve your prompts by reviewing the prompt and image attribute guide.
Get started with Imagen 3
The integration of Imagen 3 is similar to adding Gemini access via Vertex AI in Firebase. Start by adding the gradle dependencies to your Android project:
dependencies { implementation(platform("com.google.firebase:firebase-bom:33.10.0")) implementation("com.google.firebase:firebase-vertexai") }
Then, in your Kotlin code, create an ImageModel instance by passing the model name and optionally, a model configuration and safety settings:
val imageModel = Firebase.vertexAI.imagenModel( modelName = "imagen-3.0-generate-001", generationConfig = ImagenGenerationConfig( imageFormat = ImagenImageFormat.jpeg(compresssionQuality = 75), addWatermark = true, numberOfImages = 1, aspectRatio = ImagenAspectRatio.SQUARE_1x1 ), safetySettings = ImagenSafetySettings( safetyFilterLevel = ImagenSafetyFilterLevel.BLOCK_LOW_AND_ABOVE personFilterLevel = ImagenPersonFilterLevel.ALLOW_ADULT ) )
Finally generate the image by calling generateImages:
val imageResponse = imageModel.generateImages( prompt = "An astronaut riding a horse" )
Retrieve the generated image from the imageResponse and display it as a bitmap as follow:
val image = imageResponse.images.first() val uiImage = image.asBitmap()
Next steps
Explore the comprehensive Firebase documentation for detailed API information.
Access to Imagen 3 using Vertex AI in Firebase is currently in Public Preview, giving you an early opportunity to experiment and innovate. For pricing details, please refer to the Vertex AI in Firebase pricing page.
Start experimenting with Imagen 3 today! We’re looking forward to seeing how you’ll leverage Imagen 3’s capabilities to create truly unique, immersive and personalized Android experiences.
You Might Also Like
Top announcements to know from Google Play at I/O ‘25
Posted by Raghavendra Hareesh Pottamsetty – Google Play Developer and Monetization Lead At Google Play, we're dedicated to helping people...
7 Steps To Figure Out How Much You Need To Retire Comfortably
Have you ever asked yourself, “How much money do I need to retire comfortably?” If so, you’re definitely not alone,...
Google Play’s Indie Games Fund in Latin America returns for its 4th year
Posted by Daniel Trócoli – Google Play Partnerships We're thrilled to announce the return of Google Play's Indie Games Fund...
20 Best Freelance Sites To Find Jobs And Make Money
Are you looking for the best freelance sites to find jobs? If you’ve been wanting to start freelancing, this article...