ImagenModelFutures

@PublicPreviewAPI
abstract class ImagenModelFutures


Wrapper class providing Java compatible methods for ImagenModel.

See also
ImagenModel

Summary

Public companion functions

ImagenModelFutures
from(model: ImagenModel)

Public functions

abstract ListenableFuture<ImagenGenerationResponse<ImagenInlineImage>>
editImage(referenceImages: List<ImagenReferenceImage>, prompt: String)

Generates an image from a single or set of base images, returning the result directly to the caller.

abstract ListenableFuture<ImagenGenerationResponse<ImagenInlineImage>>
editImage(
    referenceImages: List<ImagenReferenceImage>,
    prompt: String,
    config: ImagenEditingConfig?
)

Generates an image from a single or set of base images, returning the result directly to the caller.

abstract ListenableFuture<ImagenGenerationResponse<ImagenInlineImage>>

Generates an image, returning the result directly to the caller.

abstract ImagenModel

Returns the ImagenModel object wrapped by this object.

abstract ListenableFuture<ImagenGenerationResponse<ImagenInlineImage>>
inpaintImage(
    image: ImagenInlineImage,
    prompt: String,
    mask: ImagenMaskReference,
    config: ImagenEditingConfig
)

Generates an image by inpainting a masked off part of a base image.

abstract ListenableFuture<ImagenGenerationResponse<ImagenInlineImage>>
outpaintImage(
    image: ImagenInlineImage,
    newDimensions: Dimensions,
    newPosition: ImagenImagePlacement,
    prompt: String,
    config: ImagenEditingConfig?
)

Generates an image by outpainting the image, extending its borders

Public companion functions

from

fun from(model: ImagenModel): ImagenModelFutures
Returns
ImagenModelFutures

a ImagenModelFutures created around the provided ImagenModel

Public functions

editImage

abstract fun editImage(referenceImages: List<ImagenReferenceImage>, prompt: String): ListenableFuture<ImagenGenerationResponse<ImagenInlineImage>>

Generates an image from a single or set of base images, returning the result directly to the caller.

Parameters
referenceImages: List<ImagenReferenceImage>

the image inputs given to the model as a prompt

prompt: String

the text input given to the model as a prompt

editImage

abstract fun editImage(
    referenceImages: List<ImagenReferenceImage>,
    prompt: String,
    config: ImagenEditingConfig? = null
): ListenableFuture<ImagenGenerationResponse<ImagenInlineImage>>

Generates an image from a single or set of base images, returning the result directly to the caller.

Parameters
referenceImages: List<ImagenReferenceImage>

the image inputs given to the model as a prompt

prompt: String

the text input given to the model as a prompt

config: ImagenEditingConfig? = null

the editing configuration settings

generateImages

abstract fun generateImages(prompt: String): ListenableFuture<ImagenGenerationResponse<ImagenInlineImage>>

Generates an image, returning the result directly to the caller.

Parameters
prompt: String

The main text prompt from which the image is generated.

getImageModel

abstract fun getImageModel(): ImagenModel

Returns the ImagenModel object wrapped by this object.

inpaintImage

abstract fun inpaintImage(
    image: ImagenInlineImage,
    prompt: String,
    mask: ImagenMaskReference,
    config: ImagenEditingConfig
): ListenableFuture<ImagenGenerationResponse<ImagenInlineImage>>

Generates an image by inpainting a masked off part of a base image.

Parameters
image: ImagenInlineImage

the base image

prompt: String

the text input given to the model as a prompt

mask: ImagenMaskReference

the mask which defines where in the image can be painted by imagen.

config: ImagenEditingConfig

the editing configuration settings, it should include an ImagenEditMode

outpaintImage

abstract fun outpaintImage(
    image: ImagenInlineImage,
    newDimensions: Dimensions,
    newPosition: ImagenImagePlacement = ImagenImagePlacement.CENTER,
    prompt: String = "",
    config: ImagenEditingConfig? = null
): ListenableFuture<ImagenGenerationResponse<ImagenInlineImage>>

Generates an image by outpainting the image, extending its borders

Parameters
image: ImagenInlineImage

the base image

newDimensions: Dimensions

the new dimensions for the image, must be larger than the original image.

newPosition: ImagenImagePlacement = ImagenImagePlacement.CENTER

the placement of the base image within the new image. This can either be coordinates (0,0 is the top left corner) or an alignment (ex: ImagenImagePlacement.BOTTOM_CENTER)

prompt: String = ""

optional, but can be used to specify the background generated if context is insufficient

config: ImagenEditingConfig? = null

the editing configuration settings