A partir de 29 de abril de 2025, os modelos Gemini 1.5 Pro e Gemini 1.5 Flash não estarão disponíveis em projetos que não os usaram antes, incluindo novos projetos. Para mais detalhes, consulte Versões e ciclo de vida do modelo.
Clique em Imagen. A página de geração de imagens do Imagen Media Studio é exibida.
No painel Configurações, ajuste as seguintes opções:
Modelo: escolha um modelo entre as opções disponíveis.
Para mais informações sobre os modelos disponíveis, consulte Modelos do Imagen.
Resolução de saída: escolha uma resolução de saída entre as opções disponíveis.
Na caixa Escreva seu comando, insira o comando de texto que descreve
as imagens a serem geradas. Por exemplo, "small boat on water in the morning
watercolor illustration".
Clique em sendGerar.
REST
Antes de usar os dados da solicitação abaixo, faça as substituições a seguir:
REGION: a região em que o projeto está localizado. Para mais informações sobre as regiões com suporte,
consulte Locais da IA generativa na
Vertex AI.
TEXT_PROMPT: o prompt de texto a ser usado para gerar imagens.
PROJECT_ID: o ID do projeto do Google Cloud .
MODEL_VERSION:
A versão do modelo do Imagen a ser usada. Os seguintes valores são aceitos ao usar sampleImageSize:
imagen-4.0-generate-001
imagen-4.0-ultra-generate-001
IMAGE_RESOLUTION: a resolução da imagem de saída. Os seguintes itens são aceitos:
"1K"
"2K"
A configuração padrão é "1K".
IMAGE_COUNT: o número de imagens a serem geradas. O intervalo de valores aceito é de 1 a 4.
Método HTTP e URL:
POST https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/publishers/google/models/MODEL_VERSION:predict
A solicitação retorna objetos de imagem. Neste exemplo, dois objetos de imagem são retornados, com dois objetos de previsão como imagens codificadas em base64.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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"]]