Generate Stunning Visuals in Your Android Apps with Imagen 3 via Vertex AI in Firebase

Generate Stunning Visuals in Your Android Apps with Imagen 3 via Vertex AI in Firebase

Home » News » Generate Stunning Visuals in Your Android Apps with Imagen 3 via Vertex AI in Firebase
Table of Contents

Posted by Thomas Ezan Sr. – Android Developer Relation Engineer (@lethargicpanda)

Imagen 3, our most superior picture technology mannequin, is now out there by means of Vertex AI in Firebase, making it even simpler to combine it to your Android apps.

Designed to generate well-composed photos with distinctive particulars, lowered artifacts, and wealthy lighting, Imagen 3 represents a major leap ahead in picture technology capabilities.

Hot air balloons float over a scenic desert landscape with unique rock formations.

Picture generated by Imagen 3 with immediate: “Shot within the model of DSLR digicam with the polarizing filter. A photograph of two sizzling air balloons over the distinctive rock formations in Cappadocia, Turkey. The colours and patterns on these balloons distinction fantastically towards the earthy tones of the panorama beneath. This shot captures the sense of journey that comes with having fun with such an expertise.”

A wooden robot stands in a field of yellow flowers, holding a small blue bird on its outstretched hand.

Picture generated by Imagen 3 with immediate: A weathered, wood mech robotic lined in flowering vines stands peacefully in a subject of tall wildflowers, with a small blue chook resting on its outstretched hand. Digital cartoon, with heat colours and tender strains. A big cliff with a waterfall looms behind.

Imagen 3 unlocks thrilling new prospects for Android builders. Generated visuals can adapt to the content material of your app, making a extra participating consumer expertise. As an illustration, your customers can generate customized art work to boost their in-app profile. Imagen may also enhance your app’s storytelling by bringing its narratives to life with pleasant personalised illustrations.

You’ll be able to experiment with picture prompts in Vertex AI Studio, and discover ways to enhance your prompts by reviewing the immediate and picture attribute information.

Get began with Imagen 3

The mixing of Imagen 3 is just like including Gemini entry through Vertex AI in Firebase. Begin by including the gradle dependencies to your Android challenge:

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 occasion by passing the mannequin identify and optionally, a mannequin configuration and security 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
  )
)

Lastly generate the picture by calling generateImages:

val imageResponse = imageModel.generateImages(
  immediate = "An astronaut driving a horse"
)

Retrieve the generated picture from the imageResponse and show it as a bitmap as comply with:

val picture = imageResponse.photos.first()
val uiImage = picture.asBitmap()

Subsequent steps

Discover the great Firebase documentation for detailed API info.

Entry to Imagen 3 utilizing Vertex AI in Firebase is at present in Public Preview, providing you with an early alternative to experiment and innovate. For pricing particulars, please seek advice from the Vertex AI in Firebase pricing web page.

Begin experimenting with Imagen 3 as we speak! We’re wanting ahead to seeing the way you’ll leverage Imagen 3’s capabilities to create actually distinctive, immersive and personalised Android experiences.

Supply hyperlink

author avatar
roosho Senior Engineer (Technical Services)
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 
share this article.

Enjoying my articles?

Sign up to get new content delivered straight to your inbox.

Please enable JavaScript in your browser to complete this form.
Name