Imagen 4

Imagen 4 is Google’s most advanced AI image generation model, creating detailed, photorealistic or abstract images from text prompts. It excels at fine details and accurate text, perfect for professional visuals like posters and presentations.


API

If you're looking for an API, you can choose from your desired programming language.

POST
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 import requests import base64 # Use this function to convert an image file from the filesystem to base64 def image_file_to_base64(image_path): with open(image_path, 'rb') as f: image_data = f.read() return base64.b64encode(image_data).decode('utf-8') # Use this function to fetch an image from a URL and convert it to base64 def image_url_to_base64(image_url): response = requests.get(image_url) image_data = response.content return base64.b64encode(image_data).decode('utf-8') # Use this function to convert a list of image URLs to base64 def image_urls_to_base64(image_urls): return [image_url_to_base64(url) for url in image_urls] api_key = "YOUR_API_KEY" url = "https://api.segmind.com/v1/imagen-4" # Request payload data = { "prompt": "A cozy cabin in the snowy mountains at sunrise, soft warm light, ultra-detailed, cinematic atmosphere", "negative_prompt": "blurry, pixelated", "aspect_ratio": "4:3" } headers = {'x-api-key': api_key} response = requests.post(url, json=data, headers=headers) print(response.content) # The response is the generated image
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


promptstr *

Describes the scene or subject. Try 'A serene mountain landscape at sunset' for scenic compositions.


negative_promptstr ( default: blurry, pixelated )

Specifies elements to avoid. Use 'blurry, pixelated' to enhance image clarity.


aspect_ratioenum:str ( default: 4:3 )

Determines the image's shape. Choose '4:3' for photos or '16:9' for widescreen imagery.

Allowed values:

To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.

Resources to get you started

Everything you need to know to get the most out of Imagen 4

# Guide to Using Imagen 4 Effectively

Google’s Imagen 4 delivers state-of-the-art text-to-image performance, balancing fidelity, speed and integration. This guide helps you choose the right parameters for varied use cases—whether you’re crafting photorealistic renders, marketing visuals or social media assets.

## 1. Core Parameters

- **prompt** (required): Describe scene, style, mood.  
- **negative_prompt** (advanced): Exclude unwanted traits (e.g., “blurry, pixelated”).  
- **aspect_ratio**: Pick from 1:1, 4:3, 3:4, 9:16, 16:9.  
- **seed** (advanced): Fix for reproducibility or leave blank/random for fresh variation.

## 2. Photorealistic Marketing & Print

- prompt: “A high-res product shot of a stainless steel water bottle on a marble countertop”  
- negative_prompt: “blurry, low-contrast, noise”  
- aspect_ratio: 16:9 (wide banners) or 4:3 (catalog pages)  
- seed: 42 (consistent branding across campaigns)  

Leverage Imagen 4’s output for brochures, posters and website hero images. A fixed seed ensures every generation matches your brand tone.

## 3. UI Mockups & Product Visualizations

- prompt: “Minimalist dashboard UI with pastel accents, interactive charts and icon set”  
- negative_prompt: “distorted text, misaligned elements”  
- aspect_ratio: 4:3 (desktop) or 3:4 (tablet)  
- seed: 12345 (repeatable iterations)  

Use concise, component-focused prompts. Negative prompts help eliminate distortions in text or icons, maintaining pixel-perfect fidelity.

## 4. Social Media & Story Content

- prompt: “Vibrant festival scene with neon lights and diverse crowd, cinematic style”  
- negative_prompt: “oversaturated, grainy”  
- aspect_ratio: 9:16 for Reels/Stories or 1:1 for feeds  
- seed: (leave blank) for endless creative feeds  

Real-time speed and vertical or square ratios streamline asset creation for Instagram, TikTok and Snapchat.

## 5. Abstract & Concept Art

- prompt: “Surreal floating islands enveloped in pastel clouds, dreamlike watercolor”  
- negative_prompt: “pixelated, low-detail”  
- aspect_ratio: 1:1 (gallery style) or 16:9 (wide canvas)  
- seed: (random) to explore new compositions each time  

Emphasize texture and mood words. Random seeds foster serendipitous art direction and fresh concept sketches.

---

By tuning these parameters—prompt specificity, negative filtering, aspect ratio and seed—you’ll harness Imagen 4’s full potential for any project, from high-fidelity print to dynamic digital storytelling.

Other Popular Models

Discover other models you might be interested in.

Cookie settings

We use cookies to enhance your browsing experience, analyze site traffic, and personalize content. By clicking "Accept all", you consent to our use of cookies.