ImagenGenerationConfig
@available(*, deprecated, message: "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﹚.")
public struct ImagenGenerationConfigConfiguration 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
sampleCountdocumentation 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
ImagenAspectRatiofor more details.Declaration
Swift
public var aspectRatio: ImagenAspectRatio? -
The image format of generated images.
Defaults to PNG. See
ImagenImageFormatfor 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;falsedisables watermarking.Important
The default value depends on the model; see the
addWatermarkdocumentation 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
negativePromptSpecifies elements to exclude from the generated image; disabled if not specified. See
negativePrompt.numberOfImagesThe number of image samples to generate; defaults to 1 if not specified. See
numberOfImages.aspectRatioThe aspect ratio of generated images; defaults to to square, 1:1. See
aspectRatio.imageFormatThe image format of generated images; defaults to PNG. See
imageFormat.addWatermarkWhether to add an invisible watermark to generated images; the default value depends on the model. See
addWatermark.