Auf dieser Seite wird beschrieben, wie Sie einen optionalen Imagen on Vertex AI-Parameter festlegen, um die von Ihnen verwendete Promptsprache anzugeben. Wenn Sie keine Sprache angeben, wird die Sprache von Imagen automatisch erkannt.
Bild, das aus dem Prompt generiert wurde: ऊपर से देखा गया किताबों का ढेर। सबसे ऊपरी पुस्तक में
एक पक्षी का जलरंग चित्रण है। किताब पर VERTEX AI मोटे अक्षरों में लिखा हुआ है
1
1Ein Stapel Bücher, der von oben gesehen wird. Das oberste Buch enthält eine Wasserfarbeabbildung von einem Vogel. VERTEX AI ist auf dem Buch fett formatiert.
Bild, das aus dem Prompt generiert wurde: 어두운 노란색과 청록색으로 이루어진 밝은
색의 옷을입고 귀걸이를 끼고있는 여자 포스트 모던 패션 사진 2
2Frau, die helle Farben trägt, im Stil von dunklem Gelb und dunklem Cyan, mit Ohrringen, postmoderne Modefotografie.
Sprache des Text-Prompts festlegen
Die folgenden Eingabewerte werden für die Sprache des Text-Prompts unterstützt:
Chinesisch (vereinfacht) (zh/zh-CN)
Chinesisch (traditionell) (zh-TW)
Englisch (en, Standardwert)
Französisch (fr)
Deutsch (de)
Hindi (hi)
Japanisch (ja)
Koreanisch (ko)
Portugiesisch (pt)
Spanisch (es)
Console
Wenn Ihr Prompt in einer der unterstützten Sprachen vorliegt, erkennt Imagen Ihren Text und übersetzt ihn und gibt die generierten oder bearbeiteten Bilder zurück.
Wenn Ihr Prompt in einer nicht unterstützten Sprache verfasst ist, verwendet Imagen den Text unverändert für die Anfrage. Dies kann zu unerwarteten Ergebnissen führen.
REST
Ersetzen Sie diese Werte in den folgenden Anfragedaten:
TEXT_PROMPT: Der Text-Prompt, der bestimmt, welche Bilder das Modell generiert. Dieses Feld ist sowohl zum Erstellen als auch zum Bearbeiten erforderlich.
PROMPT_LANGUAGE: String. Optional. Der Sprachcode, der der Sprache Ihres Text-Prompts entspricht.
In diesem Beispiel wäre das hi. Verfügbare Werte:
auto - Automatische Erkennung. Wenn Imagen eine unterstützte Sprache erkennt, wird der Prompt (und optional ein negativer Prompt) ins Englische übersetzt. Wenn die erkannte Sprache nicht unterstützt wird, verwendet Imagen den Eingabetext unverändert, was zu unerwarteten Ergebnissen führen kann. Es wird kein Fehlercode zurückgegeben.
en - Englisch (Standardwert, wenn nicht angegeben)
es - Spanisch
hi - Hindi
ja - Japanisch
ko - Koreanisch
pt - Portugiesisch
zh-TW - Chinesisch (traditionell)
zh oder zh-CN - Chinesisch (vereinfacht)
HTTP-Methode und URL:
POST https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/imagegeneration@005:predict
JSON-Text der Anfrage:
{
"instances": [
{
"prompt": "सूर्यास्त के समय एक समुद्र तट। उड़ते पक्षी, हवा में लहराते नारियल के पेड़। लोग समुद्र तट पर सैर का आनंद ले रहे हैं।"
}
],
"parameters": {
"language": "PROMPT_LANGUAGE"
}
}
Wenn Sie die Anfrage senden möchten, wählen Sie eine der folgenden Optionen aus:
curl
Speichern Sie den Anfragetext in einer Datei mit dem Namen request.json und führen Sie den folgenden Befehl aus:
Die folgende Beispielantwort bezieht sich auf eine Anfrage mit "sampleCount": 2. Die Antwort gibt zwei Vorhersageobjekte zurück, wobei die generierten Bildbyte base64-codiert sind.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[],[],null,["# Set text prompt language\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\n\n| **Preview**\n|\n|\n| This Imagen feature is a Preview offering, subject to the\n| \"Pre-GA Offerings Terms\" of the [Google\n| Cloud Service Specific Terms](/terms/service-terms). Pre-GA products and features may have\n| limited support, and changes to pre-GA products and features may not be\n| compatible with other pre-GA versions. For more information, see the [launch stage descriptions](/products#product-launch-stages).\n| Further, by using this Imagen feature, you agree to the\n| Generative AI Preview\n| [terms and conditions](/trustedtester/aitos) (\"Preview Terms\").\n\n\u003cbr /\u003e\n\n\n[Try image generation (Vertex AI Studio)](https://console.cloud.google.com/vertex-ai/studio/media/generate;tab=image)\n\n[Try Imagen in a Colab](https://colab.research.google.com/github/GoogleCloudPlatform/generative-ai/blob/main/vision/getting-started/imagen4_image_generation.ipynb)\n\nThis page describes how you can set an optional Imagen on Vertex AI parameter to\nspecify the prompt language that you use. If you don't specify a language, then\nImagen automatically detects the language.\n| **Note:** While Imagen models support only English natively, Imagen uses translation to translate several non-English language prompts to English to feed the model.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nSet text prompt language\n------------------------\n\nThe following input values are supported for the text-prompt lanague:\n\n- Chinese (simplified) (`zh`/`zh-CN`)\n- Chinese (traditional) (`zh-TW`)\n- English (`en`, default value)\n- French (`fr`)\n- German (`de`)\n- Hindi (`hi`)\n- Japanese (`ja`)\n- Korean (`ko`)\n- Portuguese (`pt`)\n- Spanish (`es`)\n\n### Console\n\nIf your prompt is in one of the supported languages,\nImagen detects and translates your text and\nreturns your generated or edited images.\n\nIf your prompt is in an unsupported language, Imagen uses\nthe text verbatim for the request. This might result in unexpected output.\n\n### REST\n\n\n| **Important:** `imagen-3.0-generate-002` doesn't support the text prompt language feature.\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\"\u003eTEXT_PROMPT\u003c/var\u003e: The text prompt that guides what images the model generates. This field is required for both generation and editing.\n- \u003cvar translate=\"no\"\u003ePROMPT_LANGUAGE\u003c/var\u003e: string. Optional. The language code that corresponds to your text prompt language. In this example it would be `hi`. Available values:\n - `auto` - Automatic detection. If Imagen detects a supported language, the prompt (and optionally, a negative prompt), are translated to English. If the language detected is not supported, Imagen uses the input text verbatim, which might result in unexpected output. No error code is returned.\n - `en` - English (default value if omitted)\n - `es` - Spanish\n - `hi` - Hindi\n - `ja` - Japanese\n - `ko` - Korean\n - `pt` - Portuguese\n - `zh-TW` - Chinese (traditional)\n - `zh` or `zh-CN` - Chinese (simplified)\n\n\nHTTP method and URL:\n\n```\nPOST https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/imagegeneration@005:predict\n```\n\n\nRequest JSON body:\n\n```\n{\n \"instances\": [\n {\n \"prompt\": \"सूर्यास्त के समय एक समुद्र तट। उड़ते पक्षी, हवा में लहराते नारियल के पेड़। लोग समुद्र तट पर सैर का आनंद ले रहे हैं।\"\n }\n ],\n \"parameters\": {\n \"language\": \"\u003cvar translate=\"no\"\u003ePROMPT_LANGUAGE\u003c/var\u003e\"\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://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/imagegeneration@005: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://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/imagegeneration@005: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\nWhat's next\n-----------\n\n- [Use prompt rewriter](/vertex-ai/generative-ai/docs/image/use-prompt-rewriter)\n- [Configure aspect ratio](/vertex-ai/generative-ai/docs/image/configure-aspect-ratio)\n- [Omit content using a negative prompt](/vertex-ai/generative-ai/docs/image/omit-content-using-a-negative-prompt)\n- [Generate deterministic images](/vertex-ai/generative-ai/docs/image/generate-deterministic-images)"]]