Generating Images With Google’s Imagen 3 APIs
Mar 2025
Evolution of AI-driven Image Generation
Image generation has improved drastically from the early days:
Applications Are Numerous
Prompt: “Create an image using Imagen 3 as per this description: A collage of images, all of equal sizes, showcasing different use cases: a product design, an advertisement featuring a person, a videogame scene, a building architecture”
🡨 Image generated by Imagen 3
Imagen 3
Prompting For Image Generation
Prompt (max 480 tokens): Generate a highly detailed, ultra-realistic portrait of a young woman with light olive skin and green eyes. She has well-defined, arched eyebrows, natural freckles across her cheeks and nose, and soft, full lips. Her brown hair is tied back loosely with a few strands framing her face. She wears minimal makeup, with a fresh and natural appearance. The lighting is soft and natural, casting subtle shadows that enhance the contours of her face. The background is blurred greenery, suggesting an outdoor setting. Photorealistic, cinematic style, 8K resolution, highly detailed skin texture, depth of field.
Prompting guide for Imagen: https://ai.google.dev/gemini-api/docs/imagen-prompt-guide
Colab link: https://bit.ly/Imagen3APIDemo
Code Walkthrough
Imagen 3 API Explanation
client = genai.Client(api_key='GEMINI_API_KEY’)
prompt_text = ‘Dogs chasing a cat on a beach’
config = types.GenerateImagesConfig(
number_of_images=2,
aspect_ratio='16:9',
safety_filter_level='BLOCK_MEDIUM_AND_ABOVE',
person_generation='DONT_ALLOW'
)
response = client.models.generate_images(
model='imagen-3.0-generate-002',
prompt=prompt_text,
config=config
)
Parameters Explanation:
Rate limit: 20 Images Per Minute
Pricing
Reach Us Here