Class ImageConfig
-
- All Implemented Interfaces:
public abstract class ImageConfig extends JsonSerializable
The image generation configuration to be used in GenerateContentConfig.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public abstract classImageConfig.BuilderBuilder for ImageConfig.
-
Field Summary
Fields Modifier and Type Field Description public final static StringMAX_READ_LENGTH_PROPERTY
-
Constructor Summary
Constructors Constructor Description ImageConfig()
-
Method Summary
Modifier and Type Method Description abstract Optional<String>aspectRatio()Aspect ratio of the generated images. abstract Optional<String>imageSize()Optional. abstract Optional<String>personGeneration()Controls the generation of people. abstract Optional<ProminentPeople>prominentPeople()Optional. abstract Optional<String>outputMimeType()MIME type of the generated image. abstract Optional<Integer>outputCompressionQuality()Compression quality of the generated image (for ``image/jpeg`` only). abstract Optional<ImageConfigImageOutputOptions>imageOutputOptions()Optional. static ImageConfig.Builderbuilder()Instantiates a builder for ImageConfig. abstract ImageConfig.BuildertoBuilder()Creates a builder with the same values as this instance. static ImageConfigfromJson(String jsonString)Deserializes a JSON string to a ImageConfig object. -
Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
aspectRatio
abstract Optional<String> aspectRatio()
Aspect ratio of the generated images. Supported values are "1:1", "2:3", "3:2", "3:4", "4:3", "9:16", "16:9", and "21:9".
-
imageSize
abstract Optional<String> imageSize()
Optional. Specifies the size of generated images. Supported values are `1K`, `2K`, `4K`. If not specified, the model will use default value `1K`.
-
personGeneration
abstract Optional<String> personGeneration()
Controls the generation of people. Supported values are: ALLOW_ALL, ALLOW_ADULT, ALLOW_NONE.
-
prominentPeople
abstract Optional<ProminentPeople> prominentPeople()
Optional. Controls whether prominent people (celebrities) generation is allowed. If used with personGeneration, personGeneration enum would take precedence. For instance, if ALLOW_NONE is set, all person generation would be blocked. If this field is unspecified, the default behavior is to allow prominent people. This field is not supported in Gemini API.
-
outputMimeType
abstract Optional<String> outputMimeType()
MIME type of the generated image. This field is not supported in Gemini API.
-
outputCompressionQuality
abstract Optional<Integer> outputCompressionQuality()
Compression quality of the generated image (for ``image/jpeg`` only). This field is not supported in Gemini API.
-
imageOutputOptions
abstract Optional<ImageConfigImageOutputOptions> imageOutputOptions()
Optional. The image output format for generated images. This field is not supported in Gemini API.
-
builder
static ImageConfig.Builder builder()
Instantiates a builder for ImageConfig.
-
toBuilder
abstract ImageConfig.Builder toBuilder()
Creates a builder with the same values as this instance.
-
fromJson
static ImageConfig fromJson(String jsonString)
Deserializes a JSON string to a ImageConfig object.
-
-
-
-