A partire dal 29 aprile 2025, i modelli Gemini 1.5 Pro e Gemini 1.5 Flash non sono disponibili nei progetti che non li hanno mai utilizzati, inclusi i nuovi progetti. Per maggiori dettagli, vedi Versioni e ciclo di vita dei modelli.
Fai clic su Immagine. Viene visualizzata la pagina di generazione di immagini di Imagen Media Studio.
Nel riquadro Impostazioni, modifica le seguenti opzioni:
Modello: scegli un modello tra le opzioni disponibili.
Per saperne di più sui modelli disponibili, consulta Modelli
Imagen.
Risoluzione output: scegli una risoluzione output tra le opzioni disponibili.
Nella casella Scrivi il prompt, inserisci il prompt di testo che descrive
le immagini da generare. Ad esempio, "small boat on water in the morning
watercolor illustration".
Fai clic su sendGenera.
REST
Prima di utilizzare i dati della richiesta,
apporta le seguenti sostituzioni:
REGION: la regione in cui si trova il progetto. Per ulteriori informazioni sulle regioni supportate,
consulta AI generativa su
località Vertex AI.
TEXT_PROMPT: Il
prompt di testo da utilizzare per generare immagini.
PROJECT_ID: il tuo
Google Cloud ID progetto.
MODEL_VERSION:
La versione del modello Imagen da utilizzare. Di seguito sono riportati i valori accettati
quando utilizzi sampleImageSize:
imagen-4.0-generate-001
imagen-4.0-ultra-generate-001
IMAGE_RESOLUTION: La risoluzione dell'immagine
di output. Sono accettati:
"1K"
"2K"
L'impostazione predefinita è "1K".
IMAGE_COUNT: il numero di immagini da generare. L'intervallo di valori accettato è 1
a 4.
Metodo HTTP e URL:
POST https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/publishers/google/models/MODEL_VERSION:predict
La richiesta restituisce oggetti immagine. In questo esempio, vengono restituiti due oggetti immagine, con due oggetti di previsione come immagini codificate in base64.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["Imagen on Vertex AI lets you set the output resolution of generated images when you\nuse the following Imagen 4 models:\n\n- `imagen-4.0-generate-001`\n- `imagen-4.0-ultra-generate-001`\n\nConsole\n\n1. In the Google Cloud console, go to the **Vertex AI \\\u003e Media\n Studio** page.\n\n [Go to Media\n Studio](https://console.cloud.google.com/vertex-ai/studio/media/generate;tab=image)\n2. Click **Imagen**. The Imagen Media Studio image generation page is\n displayed.\n\n3. In the **Settings** panel, adjust the following options:\n\n - **Model**: Choose a model from the available options.\n\n For more information about available models, see [Imagen\n models](/vertex-ai/generative-ai/docs/models#imagen-models).\n - **Output resolution**: Choose an output resolution from the available\n options.\n\n4. In the **Write your prompt** box, enter your text prompt that describes\n the images to generate. For example, `\"small boat on water in the morning\n watercolor illustration\"`.\n\n5. Click send **Generate**.\n\nREST\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar class=\"edit\" scope=\"REGION\" translate=\"no\"\u003eREGION\u003c/var\u003e: The region that your project is located in. For more information about supported regions, see [Generative AI on\n Vertex AI locations](/vertex-ai/generative-ai/docs/learn/locations).\n- \u003cvar class=\"edit\" scope=\"TEXT_PROMPT\" translate=\"no\"\u003eTEXT_PROMPT\u003c/var\u003e: The text prompt to use to generate images.\n- \u003cvar class=\"edit\" scope=\"PROJECT_ID\" translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your Google Cloud project ID.\n- \u003cvar class=\"edit\" scope=\"MODEL_VERSION\" translate=\"no\"\u003eMODEL_VERSION\u003c/var\u003e: The Imagen model version to use. The following are accepted values when using `sampleImageSize`:\n - `imagen-4.0-generate-001`\n - `imagen-4.0-ultra-generate-001`\n- \u003cvar class=\"edit\" scope=\"IMAGE_RESOLUTION\" translate=\"no\"\u003eIMAGE_RESOLUTION\u003c/var\u003e: The output image resolution. The following are accepted:\n - `\"1K\"`\n - `\"2K\"`\n\n The default setting is `\"1K\"`.\n- \u003cvar class=\"edit\" scope=\"IMAGE_COUNT\" translate=\"no\"\u003eIMAGE_COUNT\u003c/var\u003e: The number of images to generate. The accepted range of values is `1` to `4`.\n\n\nHTTP method and URL:\n\n```\nPOST https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/publishers/google/models/MODEL_VERSION:predict\n```\n\n\nRequest JSON body:\n\n```\n{\n \"instances\": [\n {\n \"prompt\": \"TEXT_PROMPT\"\n }\n ],\n \"parameters\": {\n \"sampleImageSize\": \"IMAGE_RESOLUTION\",\n \"sampleCount\": IMAGE_COUNT\n }\n}\n```\n\nTo send your request, choose one of these options: \n\ncurl **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\ncurl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @request.json \\\n \"https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/publishers/google/models/MODEL_VERSION:predict\"\n```\n\nPowerShell **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method POST `\n -Headers $headers `\n -ContentType: \"application/json; charset=utf-8\" `\n -InFile request.json `\n -Uri \"https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/publishers/google/models/MODEL_VERSION:predict\" | Select-Object -Expand Content\n```\nThe request returns image objects. In this example, two image objects are returned, with two prediction objects as base64-encoded images.\n\n```\n{\n \"predictions\": [\n {\n \"mimeType\": \"image/png\",\n \"bytesBase64Encoded\": \"BASE64_IMG_BYTES\"\n },\n {\n \"bytesBase64Encoded\": \"BASE64_IMG_BYTES\",\n \"mimeType\": \"image/png\"\n }\n ]\n}\n```\n\n\u003cbr /\u003e"]]