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 %}
Warning: This API is now obsolete.
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).
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 | The level of compression (a number between 0 and 100). | |
| mimeType | string | The MIME type. |
| Method | Modifiers | Description |
|---|---|---|
| jpeg(compressionQuality) | static |
Creates an ImagenImageFormat for a JPEG image. |
| png() | static |
Creates an ImagenImageFormat for a PNG image. |
The level of compression (a number between 0 and 100).
Signature:
compressionQuality?: number;The MIME type.
Signature:
mimeType: string;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.
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.
}