Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference
{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Defines the image format for images generated by Imagen.
Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of ImagenModelParams.
Signature:
export declare class ImagenImageFormat
Property | Modifiers | Type | Description |
---|---|---|---|
compressionQuality | number | (Public Preview) The level of compression (a number between 0 and 100). | |
mimeType | string | (Public Preview) The MIME type. |
Method | Modifiers | Description |
---|---|---|
jpeg(compressionQuality) | static |
(Public Preview) Creates an ImagenImageFormat for a JPEG image. |
png() | static |
(Public Preview) Creates an ImagenImageFormat for a PNG image. |
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
The level of compression (a number between 0 and 100).
Signature:
compressionQuality?: number;
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
The MIME type.
Signature:
mimeType: string;
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Creates an ImagenImageFormat for a JPEG image.
Signature:
static jpeg(compressionQuality?: number): ImagenImageFormat;
Parameter | Type | Description |
---|---|---|
compressionQuality | number | The level of compression (a number between 0 and 100). |
Returns:
An ImagenImageFormat object for a JPEG image.
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Creates an ImagenImageFormat for a PNG image.
Signature:
static png(): ImagenImageFormat;
Returns:
An ImagenImageFormat object for a PNG image.
const imagenModelParams = {
// ... other ImagenModelParams
imageFormat: ImagenImageFormat.jpeg(75) // JPEG with a compression level of 75.
}