Stay organized with collections
Save and categorize content based on your preferences.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-24 UTC."],[],[],null,["# ImagenImageFormat class\n\n\u003e 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.\n\nDefines the image format for images generated by Imagen.\n\nUse 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](./vertexai.imagenmodelparams.md#imagenmodelparams_interface).\n\n**Signature:** \n\n export declare class ImagenImageFormat \n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|-------------------------------------------------------------------------------------------|-----------|--------|-------------------------------------------------------------------------------|\n| [compressionQuality](./vertexai.imagenimageformat.md#imagenimageformatcompressionquality) | | number | ***(Public Preview)*** The level of compression (a number between 0 and 100). |\n| [mimeType](./vertexai.imagenimageformat.md#imagenimageformatmimetype) | | string | ***(Public Preview)*** The MIME type. |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|-----------------------------------------------------------------------------------|-----------|----------------------------------------------------------------------------------------------------------------------------------|\n| [jpeg(compressionQuality)](./vertexai.imagenimageformat.md#imagenimageformatjpeg) | `static` | ***(Public Preview)*** Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a JPEG image. |\n| [png()](./vertexai.imagenimageformat.md#imagenimageformatpng) | `static` | ***(Public Preview)*** Creates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a PNG image. |\n\nImagenImageFormat.compressionQuality\n------------------------------------\n\n\u003e 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.\n\nThe level of compression (a number between 0 and 100).\n\n**Signature:** \n\n compressionQuality?: number;\n\nImagenImageFormat.mimeType\n--------------------------\n\n\u003e 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.\n\nThe MIME type.\n\n**Signature:** \n\n mimeType: string;\n\nImagenImageFormat.jpeg()\n------------------------\n\n\u003e 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.\n\nCreates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a JPEG image.\n\n**Signature:** \n\n static jpeg(compressionQuality?: number): ImagenImageFormat;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|--------------------|--------|--------------------------------------------------------|\n| compressionQuality | number | The level of compression (a number between 0 and 100). |\n\n**Returns:**\n\n[ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class)\n\nAn [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) object for a JPEG image.\n\nImagenImageFormat.png()\n-----------------------\n\n\u003e 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.\n\nCreates an [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) for a PNG image.\n\n**Signature:** \n\n static png(): ImagenImageFormat;\n\n**Returns:**\n\n[ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class)\n\nAn [ImagenImageFormat](./vertexai.imagenimageformat.md#imagenimageformat_class) object for a PNG image.\n\n### Example\n\n const imagenModelParams = {\n // ... other ImagenModelParams\n imageFormat: ImagenImageFormat.jpeg(75) // JPEG with a compression level of 75.\n }"]]