Skip to content

Latest commit

 

History

History
109 lines (71 loc) · 3.17 KB

File metadata and controls

109 lines (71 loc) · 3.17 KB

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 %}

ImagenImageFormat class

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 

Properties

Property Modifiers Type Description
compressionQuality number The level of compression (a number between 0 and 100).
mimeType string The MIME type.

Methods

Method Modifiers Description
jpeg(compressionQuality) static Creates an ImagenImageFormat for a JPEG image.
png() static Creates an ImagenImageFormat for a PNG image.

ImagenImageFormat.compressionQuality

The level of compression (a number between 0 and 100).

Signature:

compressionQuality?: number;

ImagenImageFormat.mimeType

The MIME type.

Signature:

mimeType: string;

ImagenImageFormat.jpeg()

Creates an ImagenImageFormat for a JPEG image.

Signature:

static jpeg(compressionQuality?: number): ImagenImageFormat;

Parameters

Parameter Type Description
compressionQuality number The level of compression (a number between 0 and 100).

Returns:

ImagenImageFormat

An ImagenImageFormat object for a JPEG image.

ImagenImageFormat.png()

Creates an ImagenImageFormat for a PNG image.

Signature:

static png(): ImagenImageFormat;

Returns:

ImagenImageFormat

An ImagenImageFormat object for a PNG image.

Example

const imagenModelParams = {
  // ... other ImagenModelParams
  imageFormat: ImagenImageFormat.jpeg(75) // JPEG with a compression level of 75.
}