Create Stunning Customized Images with Dreamin Map

In today's digital landscape, the ability to generate unique and visually appealing images is a game changer for developers and creators alike. With Dreamin Map's Cognitive Actions, specifically the "Generate Image with Inpainting and Customization" action, you can harness the power of AI to create customized images tailored to your specifications. This action not only simplifies the image generation process but also accelerates it, enabling developers to focus on creative aspects rather than technical hurdles.
Imagine needing a specific image for a game or a marketing campaign; this action allows you to generate images based on textual prompts, apply inpainting techniques, and customize various parameters to achieve the desired output. Whether you're working on a video game map, product visualization, or artistic projects, Dreamin Map provides the tools to bring your vision to life quickly and efficiently.
Prerequisites
To get started with Dreamin Map, you'll need a Cognitive Actions API key and a basic understanding of making API calls. This will enable you to integrate the image generation features seamlessly into your applications.
Generate Image with Inpainting and Customization
The "Generate Image with Inpainting and Customization" action allows you to create customized images using advanced inpainting and image-to-image transformation techniques. This action supports mask application, prompt-based guidance, and a variety of configurable options for image dimensions, output formats, and inference models. By leveraging fast generation modes, developers can obtain multiple image outputs with adjustable quality.
Input Requirements:
To use this action, you must provide a text prompt along with optional parameters such as an image mask, seed for reproducibility, image dimensions, model type, and various quality settings. Here’s a brief overview of the required and optional inputs:
- Prompt (required): A textual description guiding the image generation (e.g., "a TOK game map, a golden holy heaven").
- Mask (optional): A URI for an image mask used in inpainting mode.
- Image (optional): A URI for an input image used in image-to-image or inpainting mode.
- Model (optional): Choose between "dev" for detailed images or "schnell" for faster outputs.
- Aspect Ratio (optional): Set the desired aspect ratio for the output image.
Expected Output:
The action returns a URI of the generated image, which can be directly accessed or displayed within your application. For example, a generated image might look like this:
https://assets.cognitiveactions.com/invocations/6f67af20-e20d-4122-95e8-71c7b3f29863/da88a99e-68f5-4816-83e0-ebeca546e832.webp
Use Cases for this Specific Action:
- Game Development: Create unique game maps or assets based on textual descriptions, providing a distinct visual identity to your game.
- Marketing: Generate customized images for campaigns, allowing for quick iterations and variations based on audience feedback.
- Art Projects: Explore creative avenues by generating artwork based on specific themes or prompts, enabling artists to visualize concepts rapidly.
```python
import requests
import json
# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"
action_id = "d1837d12-d2b9-4385-a851-f29e2c65e63d" # Action ID for: Generate Image with Inpainting and Customization
# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
"model": "schnell",
"goFast": false,
"prompt": "a TOK game map, a golden holy heaven",
"loraScale": 1,
"aspectRatio": "1:1",
"outputFormat": "webp",
"guidanceScale": 3,
"outputQuality": 80,
"outputQuantity": 1,
"promptStrength": 0.8,
"approxMegapixels": "1",
"additionalLoraScale": 1,
"inferenceStepsCount": 4
}
headers = {
"Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
"Content-Type": "application/json",
# Add any other required headers for the Cognitive Actions API
}
# Prepare the request body for the hypothetical execution endpoint
request_body = {
"action_id": action_id,
"inputs": payload
}
print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")
try:
response = requests.post(
COGNITIVE_ACTIONS_EXECUTE_URL,
headers=headers,
json=request_body
)
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
result = response.json()
print("Action executed successfully. Result:")
print(json.dumps(result, indent=2))
except requests.exceptions.RequestException as e:
print(f"Error executing action {action_id}: {e}")
if e.response is not None:
print(f"Response status: {e.response.status_code}")
try:
print(f"Response body: {e.response.json()}")
except json.JSONDecodeError:
print(f"Response body (non-JSON): {e.response.text}")
print("------------------------------------------------")
## Conclusion
Dreamin Map's "Generate Image with Inpainting and Customization" action empowers developers to create stunning, customized images effortlessly. By leveraging AI-driven image generation, you can unlock a world of creativity, whether for gaming, marketing, or artistic endeavors. To maximize your projects, consider experimenting with different prompts and settings to see how you can enhance your visual content. Start integrating this powerful tool today and watch your ideas come to life!