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.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Puoi utilizzare Imagen su Vertex AI per indicare al modello come personalizzare e trasformare
i soggetti di un'immagine in uno stile specificato in un prompt di testo.
Il prompt che utilizzi con la personalizzazione di Imagen 3 potrebbe influire sulla qualità delle immagini generate. Utilizza i seguenti modelli di prompt come
punto di partenza per scrivere prompt di personalizzazione. Potresti dover inviare diverse
richieste per ottenere l'output mirato.
Caso d'uso
Immagini di riferimento
Modello di prompt
Esempio
Personalizzazione delle istruzioni - Trasferimento dello stile
Immagine (1)
Trasforma subject in image [1] in modo che abbia uno stile
${STYLE_DESCRIPTION}. L'immagine raffigura
${IMAGE_DESCRIPTION}.
Trasforma subject in image [1] in uno stile
acquerello
dell'immagine con tecniche acquerello libere, tonalità morbida,
colori pastello, pennellate, sfondo delicato e pulito, spontaneità,
disegno in stile analogico, pittura intricata e molto dettagliata. L'immagine
raffigura il ritratto di una donna orgogliosa.
Personalizzare utilizzando la personalizzazione delle istruzioni per il trasferimento dello stile
Utilizza i seguenti esempi di codice per specificare lo stile delle immagini di output in base
allo stile descritto nel prompt di testo.
REST
Prima di utilizzare i dati della richiesta,
apporta le seguenti sostituzioni:
LOCATION: la regione del progetto. Ad esempio,
us-central1, europe-west2 o asia-northeast3. Per un elenco
delle regioni disponibili, consulta
Località dell'AI generativa su Vertex AI.
TEXT_PROMPT: Il prompt di testo guida le immagini che il modello genera. Per utilizzare la personalizzazione di Imagen 3, includi l'referenceId dell'immagine o delle immagini di riferimento che fornisci nel formato [$referenceId]. Ad esempio:
Trasforma il soggetto nell'immagine [1] in modo che abbia uno stile di immagine
a vetrata digitale.
Aggiungi un cappello da cowboy rosso al gatto nell'immagine [1].
Rimuovi il cane corgi nell'immagine [1].
Cambia la palla rossa nell'immagine [1] con una casella blu.
"referenceId": L'ID dell'immagine di riferimento o l'ID di una serie di immagini di riferimento
che corrispondono allo stesso soggetto o stile.
BASE64_REFERENCE_IMAGE: Un'immagine di riferimento per guidare la generazione di immagini. L'immagine
deve essere specificata come stringa di byte con codifica base64.
IMAGE_COUNT: Il numero di immagini generate.
Valori interi accettati: 1-4. Il valore predefinito è 4.
Metodo HTTP e URL:
POST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagen-3.0-capability-001:predict
La seguente risposta di esempio è per una richiesta con
"sampleCount": 2. La risposta restituisce due oggetti di previsione, con
i byte dell'immagine generata codificati 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,["# Instruct Customization\n\n| **Caution:** Starting on June 24, 2025, Imagen versions 1 and 2 are deprecated. Imagen models `imagegeneration@002`, `imagegeneration@005`, and `imagegeneration@006` will be removed on September 24, 2025 . For more information about migrating to Imagen 3, see [Migrate to\n| Imagen 3](/vertex-ai/generative-ai/docs/image/migrate-to-imagen-3).\n\n\u003cbr /\u003e\n\nYou can use Imagen on Vertex AI to instruct the model how to customize and transform\nthe subjects in an image to a style that you specify in a text prompt.\n\n\n[View Imagen for Editing and Customization model card](https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/imagen-3.0-capability-001)\n\nCustomization prompt writing\n----------------------------\n\nThe prompt that you use with Imagen 3 Customization might affect the\nquality of your generated images. Use the following prompt templates as a\nstarting point for writing customization prompts. You might need to send several\nrequests to get your targeted output.\n\nCustomize using instruct customization for style transfer\n---------------------------------------------------------\n\n\n| To see an example of Imagen 3 Customization,\n| run the \"Imagen 3 Customized Images\" notebook in one of the following\n| environments:\n|\n| [Open in Colab](https://colab.research.google.com/github/GoogleCloudPlatform/generative-ai/blob/main/vision/getting-started/imagen3_customization.ipynb)\n|\n|\n| \\|\n|\n| [Open in Colab Enterprise](https://console.cloud.google.com/vertex-ai/colab/import/https%3A%2F%2Fraw.githubusercontent.com%2FGoogleCloudPlatform%2Fgenerative-ai%2Fmain%2Fvision%2Fgetting-started%2Fimagen3_customization.ipynb)\n|\n|\n| \\|\n|\n| [Open\n| in Vertex AI Workbench](https://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=https%3A%2F%2Fraw.githubusercontent.com%2FGoogleCloudPlatform%2Fgenerative-ai%2Fmain%2Fvision%2Fgetting-started%2Fimagen3_customization.ipynb)\n|\n|\n| \\|\n|\n| [View on GitHub](https://github.com/GoogleCloudPlatform/generative-ai/blob/main/vision/getting-started/imagen3_customization.ipynb)\n\n\u003cbr /\u003e\n\nUse the following code samples to specify the style of the output images based\non the style described in the text prompt. \n\n### REST\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#identifiers).\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: Your project's region. For example, `us-central1`, `europe-west2`, or `asia-northeast3`. For a list of available regions, see [Generative AI on Vertex AI locations](/vertex-ai/generative-ai/docs/learn/locations-genai).\n- \u003cvar translate=\"no\"\u003eTEXT_PROMPT\u003c/var\u003e: The text prompt guides what images the model generates. To use Imagen 3 Customization, include the `referenceId` of the reference image or images you provide in the format \u003cvar translate=\"no\"\u003e[$referenceId]\u003c/var\u003e. For example:\n - *Transform the subject in image \u003cvar translate=\"no\"\u003e[1]\u003c/var\u003e to have a Digital Stained Glass style\n image style.*\n - *Add a red cowboy hat to the cat in the image \u003cvar translate=\"no\"\u003e[1]\u003c/var\u003e.*\n - *Remove the corgi dog in the image \u003cvar translate=\"no\"\u003e[1]\u003c/var\u003e.*\n - *Change the red ball in the image \u003cvar translate=\"no\"\u003e[1]\u003c/var\u003e to a blue box.*\n- `\"referenceId\"`: The ID of the reference image, or the ID for a series of reference images that correspond to the same subject or style.\n- \u003cvar translate=\"no\"\u003eBASE64_REFERENCE_IMAGE\u003c/var\u003e: A reference image to guide image generation. The image must be specified as a [base64-encoded](/vertex-ai/generative-ai/docs/image/base64-encode) byte string.\n- \u003cvar translate=\"no\"\u003eIMAGE_COUNT\u003c/var\u003e: The number of generated images. Accepted integer values: 1-4. Default value: 4.\n\n\nHTTP method and URL:\n\n```\nPOST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagen-3.0-capability-001:predict\n```\n\n\nRequest JSON body:\n\n```\n{\n \"instances\": [\n {\n \"prompt\": \"TEXT_PROMPT\",\n \"referenceImages\": [\n {\n \"referenceType\": \"REFERENCE_TYPE_RAW\",\n \"referenceId\": 1,\n \"referenceImage\": {\n \"bytesBase64Encoded\": \"BASE64_REFERENCE_IMAGE\"\n }\n }\n ]\n }\n ],\n \"parameters\": {\n \"sampleCount\": IMAGE_COUNT\n }\n}\n```\n\nTo send your request, choose one of these options: \n\n#### curl\n\n| **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://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagen-3.0-capability-001:predict\"\n```\n\n#### PowerShell\n\n| **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://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagen-3.0-capability-001:predict\" | Select-Object -Expand Content\n```\nThe following sample response is for a request with `\"sampleCount\": 2`. The response returns two prediction objects, with the generated image bytes base64-encoded.\n\n```\n{\n \"predictions\": [\n {\n \"bytesBase64Encoded\": \"BASE64_IMG_BYTES\",\n \"mimeType\": \"image/png\"\n },\n {\n \"mimeType\": \"image/png\",\n \"bytesBase64Encoded\": \"BASE64_IMG_BYTES\"\n }\n ]\n}\n```\n\n\u003cbr /\u003e\n\nProduct usage\n-------------\n\nTo view usage standards and content restrictions associated with\nImagen on Vertex AI, see the\n[usage guidelines](/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#imagen-guidelines).\n\nModel versions\n--------------\n\nThere are multiple image generation models that you can use. For more\ninformation, see [Imagen\nmodels](/vertex-ai/generative-ai/docs/models#imagen-models).\n\nWhat's next\n-----------\n\nRead articles about Imagen and other Generative AI on Vertex AI\nproducts:\n\n- [A developer's guide to getting started with Imagen 3 on\n Vertex AI](https://cloud.google.com/blog/products/ai-machine-learning/a-developers-guide-to-imagen-3-on-vertex-ai?e=0?utm_source%3Dlinkedin)\n- [New generative media models and tools, built with and for creators](https://blog.google/technology/ai/google-generative-ai-veo-imagen-3/#veo)\n- [New in Gemini: Custom Gems and improved image generation with\n Imagen 3](https://blog.google/products/gemini/google-gemini-update-august-2024/)\n- [Google DeepMind: Imagen 3 - Our highest quality\n text-to-image model](https://deepmind.google/technologies/imagen-3/)"]]