To use Imagen on Vertex AI you must provide a text description of what you want to generate or edit. These descriptions are called prompts, and these prompts are the primary way you communicate with Generative AI on Vertex AI.
This guide shows you how modifying parts of a text-to-image prompt can produce different results and gives you examples of images you can create. This guide also provides guidance on how you can edit images using text prompts and iteration.
Product usage
To view usage standards and content restrictions associated with Imagen on Vertex AI, see the usage guidelines.
Content filtering - input text, uploaded images, and generated images
Generated images are filtered for undesirable or harmful content. Similarly, any input Imagen on Vertex AI receives is checked for offensive content. This includes the input text prompt and uploaded photos in the case of image editing. For more information, see Responsible AI and usage guidelines for Imagen.
You can also report suspected abuse of Imagen on Vertex AI or any generated output that contains inappropriate material or inaccurate information using the Report suspected abuse on Google Cloud form.
Prompt writing basics (subject, context, and style)
While there's no one way to write good prompts, adding some keywords and modifiers will help you get closer to your end goal. Prompts don't need to be long or complex, but most good prompts are descriptive and clear.
A good starting point can be to think of subject, context, and style.
Subject: The first thing to think about with any prompt is the subject: the object, person, animal, or scenery you want an image of.
Context and background: Just as important is the background or context in which the subject will be placed. Try placing your subject in a variety of backgrounds. For example, a studio with a white background, outdoors, or indoor environments.
Style: Finally, add the style of image you want. Styles can be general (painting, photograph, sketches) or very specific (pastel painting, charcoal drawing, isometric 3D).
After you write a first version of your prompt, refine your prompt by adding more details until you get to the image that you want. Iteration is important. Start by establishing your core idea, and then refine and expand upon that core idea until the generated image is close to your vision.
Imagen 3 prompt writing
Imagen 3 can transform your ideas into detailed images, whether your prompts are short or long and detailed. Refine your vision through iterative prompting, adding details until you achieve the perfect result.
Short prompts let you generate an image quickly. |
Longer prompts let you add specific details and build your image. |
Additional advice for Imagen 3 prompt writing:
- Use descriptive language: Employ detailed adjectives and adverbs to paint a clear picture for Imagen 3.
- Provide context: If necessary, include background information to aid the AI's understanding.
- Reference specific artists or styles: If you have a particular aesthetic in mind, referencing specific artists or art movements can be helpful.
- Use prompt engineering tools: Consider exploring prompt engineering tools or resources to help you refine your prompts and achieve optimal results.
- Enhancing the facial details in your personal and group images:
- Specify facial details as a focus of the photo (for example, use the word "portrait" in the prompt).
- Consider using a larger model like Imagen 3 instead of Imagen 3 Fast to improve detail.
Generate text in images
Imagen 3's ability to add text into your images opens up creative image generation possibilities. Use the following guidance to get the most out of this feature:
- Iterate with confidence: You might have to regenerate images until you achieve the look you want. Imagen's text integration is still evolving, and sometimes multiple attempts yield the best results.
- Keep it short: Limit text to 25 characters or less for optimal generation.
Multiple phrases: Experiment with two or three distinct phrases to provide additional information. Avoid exceeding three phrases for cleaner compositions.
Guide Placement: While Imagen can attempt to position text as directed, you should expect occasional variations. This feature is continually improving.
Inspire font style: Specify a general font style to subtly influence Imagen's choices. Don't rely on precise font replication, but expect creative interpretations.
Font size: Specify a font size or a general indication of size (for example, small, medium, large) to influence the font size generation.
Prompt parameterization
To better control output results, you might find it helpful to parameterize the inputs into Imagen when working with the Imagen API or Vertex AI SDK for Python. For example, suppose you want your customers to be able to generate logos for their business, and you want to make sure logos are always generated on a solid color background. You also want to limit the options that the client can select from a menu.
In this example, you can create a parameterized prompt similar to the following:
A {logo_style} logo for a {company_area} company on a solid color background. Include the text {company_name}.
In your custom user interface, the customer can input the parameters using a menu, and their chosen value populates the prompt Imagen receives.
For example:
Prompt:
A minimalist logo for a health care company on a solid color background. Include the text Journey.
Prompt:
A modern logo for a software company on a solid color background. Include the text Silo.
Prompt:
A traditional logo for a baking company on a solid color background. Include the text Seed.
Style: photography
- Prompt includes: "A photo of..."
To use this style, start with using keywords that clearly tell Imagen on Vertex AI that you're looking for a photograph. Start your prompts with "A photo of. . .". For example:
Image source: Each image was generated using its corresponding text prompt with the Imagen 3 model.
Style: illustration and art
- Prompt includes: "A painting of...", "A sketch of..."
Art styles vary from monochrome styles like pencil sketches, to hyper-realistic digital art. For example, the following images use the same prompt with different styles:
"An [art style or creation technique] of an angular sporty electric sedan with skyscrapers in the background"
Image source: Each image was generated using its corresponding text prompt with the Imagen 2 model.
Advanced prompt writing techniques
Use the following examples to create more specific prompts based on the attributes: photography descriptors, shapes and materials, historical art movements, and image quality modifiers.
Photography modifiers
In the following examples, you can see several photography-specific modifiers and parameters.
Camera Proximity - Close up, taken from far away
Camera Position - aerial, from below
Lighting - natural, dramatic, warm, cold
Camera Settings - motion blur, soft focus, bokeh, portrait
Lens types - 35mm, 50mm, fisheye, wide angle, macro
Film types - black and white, polaroid
Image source: Each image was generated using its corresponding text prompt with the Imagen 3 model.
Shapes and materials
- Prompt includes: "...made of...", "...in the shape of..."
One of the strengths of this technology is that you can create imagery that is otherwise difficult or impossible. For example, you can recreate your company logo in different materials and textures.
Image source: Each image was generated using its corresponding text prompt with the Imagen 3 model.
Historical art references
- Prompt includes: "...in the style of..."
Certain styles have become iconic over the years. The following are some ideas of historical painting or art styles that you can try.
"generate an image in the style of [art period or movement]: a wind farm"
Image source: Each image was generated using its corresponding text prompt with the Imagen 3 model.
Image quality modifiers
Certain keywords can let the model know that you're looking for a high-quality asset. Examples of quality modifiers include the following:
- General Modifiers - high-quality, beautiful, stylized
- Photos - 4K, HDR, Studio Photo
- Art, Illustration - by a professional, detailed
The following are a few examples of prompts without quality modifiers and the same prompt with quality modifiers.
Image source: Each image was generated using its corresponding text prompt with the Imagen 3 model.
Aspect ratios
Imagen 3 image generation lets you set five distinct image aspect ratios.
- Square (1:1, default) - A standard square photo. Common uses for this aspect ratio include social media posts.
Fullscreen (4:3) - This aspect ratio is commonly used in media or film. It is also the dimensions of most old (non-widescreen) TVs and medium format cameras. It captures more of the scene horizontally (compared to 1:1), making it a preferred aspect ratio for photography.
Portrait full screen (3:4) - This is the fullscreen aspect ratio rotated 90 degrees. This lets to capture more of the scene vertically compared to the 1:1 aspect ratio.
Widescreen (16:9) - This ratio has replaced 4:3 and is now the most common aspect ratio for TVs, monitors, and mobile phone screens (landscape). Use this aspect ratio when you want to capture more of the background (for example, scenic landscapes).
Portrait (9:16) - This ratio is widescreen but rotated. This a relatively new aspect ratio that has been popularized by short form video apps (for example, YouTube shorts). Use this for tall objects with strong vertical orientations such as buildings, trees, waterfalls, or other similar objects.
Negative prompts
The previous examples focus on writing prompts for what you want Imagen to create, but you can also provide a negative prompt along with the original prompt to help the product generate or edit images. These negative prompts can be a powerful tool that helps specify what elements to omit from the image. Simply describe what you don't want.
Recommended — Plainly describe what you don't want to see. For example "wall, frame".
Not recommended — Avoid instructive language or words like "no" or "don't". For example, avoid phrases like "no walls" or "don't show walls".
Photorealistic images
Different versions of the image generation model might offer a mix of artistic and photorealistic output. Use the following wording in prompts to generate more photorealistic output, based on the subject you want to generate.
Use case | Lens type | Focal lengths | Additional details |
---|---|---|---|
People (portraits) | Prime, zoom | 24-35mm | black and white film, Film noir, Depth of field, duotone (mention two colors) |
Food, insects, plants (objects, still life) | Macro | 60-105mm | High detail, precise focusing, controlled lighting |
Sports, wildlife (motion) | Telephoto zoom | 100-400mm | Fast shutter speed, Action or movement tracking |
Astronomical, landscape (wide-angle) | Wide-angle | 10-24mm | Long exposure times, sharp focus, long exposure, smooth water or clouds |
Portraits
Use case | Lens type | Focal lengths | Additional details |
---|---|---|---|
People (portraits) | Prime, zoom | 24-35mm | black and white film, Film noir, Depth of field, duotone (mention two colors) |
Using several keywords from the table, Imagen can generate the following portraits.
Prompt: A woman, 35mm portrait, blue and grey duotones
Model: Imagen 2 (imagegeneration@005
)
Prompt: A woman, 35mm portrait, film noir
Model: Imagen 2 (imagegeneration@005
)
Objects
Use case | Lens type | Focal lengths | Additional details |
---|---|---|---|
Food, insects, plants (objects, still life) | Macro | 60-105mm | High detail, precise focusing, controlled lighting |
Using several keywords from the table, Imagen can generate the following object images.
Prompt: leaf of a prayer plant, macro lens, 60mm
Model: Imagen 2 (imagegeneration@005
)
Prompt: a plate of pasta, 100mm Macro lens
Model: Imagen 2 (imagegeneration@005
)
Motion
Use case | Lens type | Focal lengths | Additional details |
---|---|---|---|
Sports, wildlife (motion) | Telephoto zoom | 100-400mm | Fast shutter speed, Action or movement tracking |
Using several keywords from the table, Imagen can generate the following motion images.
Prompt: a winning touchdown, fast shutter speed, movement tracking
Model: Imagen 2 (imagegeneration@005
)
Prompt: A deer running in the forest, fast shutter speed, movement tracking
Model: Imagen 2 (imagegeneration@005
)
Wide-angle
Use case | Lens type | Focal lengths | Additional details |
---|---|---|---|
Astronomical, landscape (wide-angle) | Wide-angle | 10-24mm | Long exposure times, sharp focus, long exposure, smooth water or clouds |
Using several keywords from the table, Imagen can generate the following wide-angle images.
Prompt: an expansive mountain range, landscape wide angle 10mm
Model: Imagen 2 (imagegeneration@005
)
Prompt: a photo of the moon, astro photography, wide angle 10mm
Model: Imagen 2 (imagegeneration@005
)
What's next
Read articles about Imagen and other Generative AI on Vertex AI products:
- A developer's guide to getting started with Imagen 3 on Vertex AI
- New generative media models and tools, built with and for creators
- New in Gemini: Custom Gems and improved image generation with Imagen 3
- Google DeepMind: Imagen 3 - Our highest quality text-to-image model