ImagenInlineImage

public final class ImagenInlineImage


Represents an Imagen-generated image that is returned as inline data.

Deprecation Notice: All Imagen models are deprecated and will shut down as early as June 2026. As a replacement, you can migrate your apps to use Gemini Image models (the 'Nano Banana' models)

Summary

Public fields

final @NonNull byte[]

The raw image bytes in JPEG or PNG format, as specified by mimeType.

final @NonNull String

The IANA standard MIME type of the image data; either "image/png" or "image/jpeg"; to request a different format, see ImagenGenerationConfig.imageFormat.

Public methods

final @NonNull Bitmap

This method is deprecated. All Imagen models are deprecated.

Public fields

data

public final @NonNull byte[] data

The raw image bytes in JPEG or PNG format, as specified by mimeType.

mimeType

public final @NonNull String mimeType

The IANA standard MIME type of the image data; either "image/png" or "image/jpeg"; to request a different format, see ImagenGenerationConfig.imageFormat.

Public methods

asBitmap

public final @NonNull Bitmap asBitmap()

Returns the image as an Android OS native Bitmap so that it can be saved or sent to the UI.

Deprecation Notice: All Imagen models are deprecated and will shut down as early as June 2026. As a replacement, you can migrate your apps to use Gemini Image models (the 'Nano Banana' models)