Create Stunning Visuals Effortlessly with Untamed Image Generation

25 Apr 2025
Create Stunning Visuals Effortlessly with Untamed Image Generation

In the digital age, the demand for high-quality visuals is ever-increasing. Untamed offers a powerful image generation service that allows developers to create and refine images using advanced features like inpainting and style guidance. With customizable options for resolution, prompt strength, and multiple refinement techniques, Untamed simplifies the process of generating stunning visuals. Whether you are looking to create unique artwork, enhance existing images, or generate assets for your projects, Untamed provides the tools needed to bring your creative visions to life.

Common Use Cases:

  • Marketing and Advertising: Generate eye-catching visuals for campaigns or social media posts.
  • Game Development: Create unique character designs or environments that stand out.
  • Art Creation: Artists can explore new styles or concepts without the need for extensive manual work.
  • Prototyping: Quickly generate images for mockups or presentations.

Prerequisites:

Before diving into the capabilities of Untamed, ensure you have a Cognitive Actions API key and a basic understanding of making API calls.

Generate and Refine Images

The Generate and Refine Images action is at the core of Untamed's image generation capabilities. It allows users to create and enhance images by combining inpainting techniques with style guidance.

Purpose: This action addresses the need for high-quality, customizable image generation. It empowers developers to create unique images that meet specific project requirements.

Input Requirements: The action accepts a structured input that includes:

  • Mask (URI): Defines areas to preserve and areas to inpaint.
  • Seed (Integer): A random seed value for reproducibility.
  • Image (URI): The input image for transformation.
  • Width (Integer): The desired output image width (default is 1024 pixels).
  • Height (Integer): The desired output image height (default is 1024 pixels).
  • Prompt (String): Descriptive text to guide image generation.
  • Lora Scale (Number): Adjusts the effect on trained models (ranging from 0 to 1).
  • Negative Prompt (String): Elements to avoid in the generated image.
  • Output Count (Integer): Number of images to generate (1 to 4).
  • Refine Style (String): Method for refining images.
  • Apply Watermark (Boolean): Option to apply a watermark.
  • Inference Steps (Integer): Total denoising steps during image generation.
  • Prompt Strength (Number): Influence of the prompt during image processing.
  • Guidance Intensity (Number): Intensity of guidance applied during generation.
  • Scheduling Strategy (String): Scheduler mechanism for denoising.

Expected Output: The action returns a URI of the generated image, showcasing the results of the applied prompt and settings.

Use Cases for this Action:

  • Generate unique artwork based on a specific concept or theme.
  • Refine existing images to enhance quality or adjust styles.
  • Create variations of an image to explore different artistic directions.
  • Develop marketing materials with custom visuals tailored to specific audiences.

```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 = "70eea1dd-7770-4d46-9dec-0f1eb0a1054d" # Action ID for: Generate and Refine Images

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "width": 1024,
  "height": 1024,
  "prompt": "In the style of TOK, gray cat that eats cat food",
  "loraScale": 0.6,
  "negPrompt": "",
  "outputCount": 1,
  "refineStyle": "no_refiner",
  "applyWatermark": true,
  "inferenceSteps": 50,
  "promptStrength": 0.8,
  "guidanceIntensity": 7.5,
  "highNoiseFraction": 0.8,
  "schedulingStrategy": "K_EULER"
}

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
Untamed's image generation capabilities empower developers to create stunning visuals with ease. Whether it's for marketing, game development, or artistic exploration, the ability to generate and refine images opens up new avenues for creativity. With its customizable options and intuitive features, Untamed is a valuable tool for anyone looking to enhance their projects with high-quality imagery. Start integrating Untamed into your workflows today and unlock the potential of effortless image generation!