FirebaseAILogic Framework Reference

ImagenGenerationConfig

public struct ImagenGenerationConfig

Configuration options for generating images with Imagen.

See Parameters for Imagen models to learn about parameters available for use with Imagen models, including how to configure them.

  • Specifies elements to exclude from the generated image.

    Defaults to nil, which disables negative prompting. Use a comma-separated list to describe unwanted elements or characteristics. See the Cloud documentation for more details.

    Important

    Support for negative prompts depends on the Imagen model.

    Declaration

    Swift

    public var negativePrompt: String?
  • The number of image samples to generate; defaults to 1 if not specified.

    Important

    The number of sample images that may be generated in each request depends on the model (typically up to 4); see the sampleCount documentation for more details.

    Declaration

    Swift

    public var numberOfImages: Int?
  • The aspect ratio of generated images.

    Defaults to to square, 1:1. Supported aspect ratios depend on the model; see ImagenAspectRatio for more details.

    Declaration

    Swift

    public var aspectRatio: ImagenAspectRatio?
  • The image format of generated images.

    Defaults to PNG. See ImagenImageFormat for more details.

    Declaration

    Swift

    public var imageFormat: ImagenImageFormat?
  • Whether to add an invisible watermark to generated images.

    If true, an invisible SynthID watermark is embedded in generated images to indicate that they are AI generated; false disables watermarking.

    Important

    The default value depends on the model; see the addWatermark documentation for model-specific details.

    Declaration

    Swift

    public var addWatermark: Bool?
  • Initializes configuration options for generating images with Imagen.

    Declaration

    Swift

    public init(negativePrompt: String? = nil, numberOfImages: Int? = nil,
                aspectRatio: ImagenAspectRatio? = nil, imageFormat: ImagenImageFormat? = nil,
                addWatermark: Bool? = nil)

    Parameters

    negativePrompt

    Specifies elements to exclude from the generated image; disabled if not specified. See negativePrompt.

    numberOfImages

    The number of image samples to generate; defaults to 1 if not specified. See numberOfImages.

    aspectRatio

    The aspect ratio of generated images; defaults to to square, 1:1. See aspectRatio.

    imageFormat

    The image format of generated images; defaults to PNG. See imageFormat.

    addWatermark

    Whether to add an invisible watermark to generated images; the default value depends on the model. See addWatermark.