Create Stunning Custom Images Effortlessly with Wanie

26 Apr 2025
Create Stunning Custom Images Effortlessly with Wanie

In today's digital landscape, visual content is more important than ever. With Wanie, developers can leverage advanced image generation capabilities to create stunning custom images tailored to their specific needs. The Cognitive Actions offered by Wanie simplify the process of generating images through advanced image-to-image transformation and inpainting, enabling quick and precise results. Whether you need to create unique visuals for marketing campaigns, enhance user interfaces, or generate content for social media, Wanie provides the tools to streamline your creative workflow.

Prerequisites

To get started with Wanie, you will need a Cognitive Actions API key and a basic understanding of making API calls. This setup will allow you to seamlessly integrate image generation capabilities into your applications.

Generate Custom Image

The Generate Custom Image action empowers developers to create images by utilizing advanced techniques such as inpainting and image-to-image transformations. This action is ideal for generating images based on specific prompts, allowing for a high degree of customization in terms of aspect ratios, formats, and visual styles.

Input Requirements

The action requires a structured input, primarily centered around the prompt, which guides the image generation process. Key input fields include:

  • Prompt: A textual description of the image you want to create (e.g., "skinny smile women at kitchen wanie realistic, show teeth, plain sleepwear").
  • Aspect Ratio: Defines the dimensions of the generated image. Users can choose from predefined ratios or specify custom dimensions.
  • Image: Optionally, an input image can be provided for transformations or inpainting.

Expected Output

The output will be a generated image based on the provided prompt and parameters, delivered in the specified format (e.g., webp, jpg, png). An example output might look like this:

  • https://assets.cognitiveactions.com/invocations/6111cf59-568e-478e-add4-cdb766aff946/48ae2782-207e-43b0-b933-d478807c6b46.webp

Use Cases for this specific action

  1. Marketing Material Creation: Generate unique images for advertisements or promotional content that capture the essence of your brand.
  2. Social Media Content: Create eye-catching visuals tailored to specific themes or campaigns, enhancing engagement with your audience.
  3. Game Development: Design assets and character images based on creative prompts, allowing for rapid prototyping and iteration.
  4. UI/UX Design: Produce custom illustrations for applications or websites, enriching the user experience with personalized graphics.

```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 = "6e6697d3-94ac-4bb3-aab5-bb4eb118fa7c" # Action ID for: Generate Custom Image

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "goFast": false,
  "prompt": "skinny smile women  at kitchen wanie realistic,show teeth, plain sleepwear",
  "loraScale": 1,
  "modelType": "dev",
  "numOutputs": 1,
  "outputFormat": "webp",
  "guidanceScale": 3,
  "outputQuality": 100,
  "extraLoraScale": 1,
  "promptStrength": 0.8,
  "imageMegapixels": "1",
  "imageAspectRatio": "2:3",
  "numInferenceSteps": 28
}

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
Wanie's **Generate Custom Image** action offers developers a powerful tool to create tailored images efficiently. Whether for marketing, content creation, or design, the flexibility and speed of this service can significantly enhance your projects. To harness the full potential of Wanie, consider exploring additional features and integrating them into your applications for a comprehensive creative solution.