Mulai 29 April 2025, model Gemini 1.5 Pro dan Gemini 1.5 Flash tidak tersedia di project yang belum pernah menggunakan model ini, termasuk project baru. Untuk mengetahui detailnya, lihat Versi dan siklus proses model.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Anda dapat menggunakan Imagen di Vertex AI untuk menginstruksikan model cara menyesuaikan dan mengubah subjek dalam gambar ke gaya yang Anda tentukan dalam perintah teks.
Perintah yang Anda gunakan dengan Penyesuaian Imagen 3 dapat memengaruhi kualitas gambar yang dihasilkan. Gunakan template perintah berikut sebagai
titik awal untuk menulis perintah penyesuaian. Anda mungkin perlu mengirim beberapa permintaan untuk mendapatkan output yang ditargetkan.
Kasus penggunaan
Gambar referensi
Template perintah
Contoh
Penyesuaian perintah - Transfer gaya
Gambar (1)
Ubah subject in image [1] agar memiliki gaya
${STYLE_DESCRIPTION}. Gambar tersebut menggambarkan
${IMAGE_DESCRIPTION}.
Ubah subject in image [1] agar memiliki gaya
lukisan cat air
gambar dengan teknik cat air yang tidak kaku, warna lembut,
warna pastel, sapuan kuas, halus, latar belakang bersih, spontanitas,
gambar gaya analog, lukisan rumit yang sangat detail. Gambar
menggambarkan potret seorang wanita yang bangga.
Menyesuaikan menggunakan penyesuaian perintah untuk transfer gaya
Gunakan contoh kode berikut untuk menentukan gaya gambar output berdasarkan gaya yang dijelaskan dalam perintah teks.
REST
Sebelum menggunakan salah satu data permintaan,
lakukan penggantian berikut:
LOCATION: Region project Anda. Misalnya,
us-central1, europe-west2, atau asia-northeast3. Untuk mengetahui daftar
region yang tersedia, lihat
Lokasi AI Generatif di Vertex AI.
TEXT_PROMPT: Perintah teks memandu gambar yang dihasilkan
model. Untuk menggunakan Penyesuaian Imagen 3, sertakan referenceId dari
gambar atau gambar referensi
yang Anda berikan dalam format [$referenceId]. Contoh:
Ubah subjek dalam gambar [1] agar memiliki gaya Digital Stained Glass
image.
Tambahkan topi koboi merah ke kucing dalam gambar [1].
Hapus corgi dalam gambar [1].
Ubah bola merah dalam gambar [1] menjadi kotak biru.
"referenceId": ID gambar referensi, atau ID untuk serangkaian gambar referensi
yang sesuai dengan subjek atau gaya yang sama.
BASE64_REFERENCE_IMAGE: Gambar referensi untuk memandu pembuatan gambar. Gambar
harus ditentukan sebagai string byte berenkode base64.
IMAGE_COUNT: Jumlah gambar yang dihasilkan.
Nilai bilangan bulat yang diterima: 1-4. Nilai default: 4.
Metode HTTP dan URL:
POST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagen-3.0-capability-001:predict
Contoh respons berikut adalah untuk permintaan dengan
"sampleCount": 2. Respons ini menampilkan dua objek prediksi, dengan byte gambar yang dihasilkan berenkode base64.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-25 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/)"]]