Create Stunning Custom Images with the zeg06/stefbo Cognitive Actions

24 Apr 2025
Create Stunning Custom Images with the zeg06/stefbo Cognitive Actions

In the realm of digital content creation, the ability to generate captivating images can greatly enhance applications, marketing campaigns, and artistic endeavors. The zeg06/stefbo spec provides a powerful set of Cognitive Actions designed for image generation, allowing developers to create custom images using advanced inpainting and image-to-image techniques. With features like model selection, aspect ratio adjustments, and quality control, these pre-built actions simplify the integration of image generation capabilities into your applications.

Prerequisites

To get started with the zeg06/stefbo Cognitive Actions, you'll need:

  • An API key for accessing the Cognitive Actions platform.
  • Familiarity with making API calls, including sending JSON payloads.

Authentication typically involves passing your API key in the request headers, ensuring secure access to the available actions.

Cognitive Actions Overview

Generate Custom Image

The Generate Custom Image action allows you to create custom images based on detailed prompts. This action utilizes advanced techniques to enable high-quality image outputs tailored to your specifications.

  • Category: Image Generation
  • Description: Create custom images using advanced inpainting and image-to-image techniques with options such as model selection, aspect ratio, quality, and more for optimized performance.

Input

The input schema for this action requires the following fields:

  • Required Field:
    • prompt: A detailed description of the image you want to generate.
  • Optional Fields:
    • mask: URI for an image mask, useful in inpainting mode.
    • seed: A random seed for reproducibility.
    • image: URI for an input image used in image-to-image mode.
    • model: The inference model to use (dev or schnell).
    • width and height: Specify dimensions for custom aspect ratios.
    • goFast: Enable faster image generation.
    • imageAspectRatio: Aspect ratio for the output image.
    • imageOutputFormat: Select the output format (e.g., webp, jpg, png).
    • Additional parameters for fine-tuning image generation.

Example Input:

{
  "model": "dev",
  "goFast": false,
  "prompt": "Ultrarealistic photo of stefbo as a superhero, face uncovered, wearing a futuristic superhero suit with intricate metallic and glowing elements. The suit combines deep navy blue, silver, and vibrant red highlights, featuring a sleek, aerodynamic design. Stefbo stands in an epic pose, with a determined gaze, in front of a cinematic cityscape illuminated by a dramatic sunset and glowing skyscrapers. The atmosphere is intense, with subtle embers and dynamic lighting effects, capturing the grandeur and heroism of an Avengers-style blockbuster film.",
  "loraScale": 1,
  "megapixels": "1",
  "numberOfOutputs": 1,
  "imageAspectRatio": "9:16",
  "imageOutputFormat": "png",
  "imageOutputQuality": 100,
  "additionalLoraScale": 1,
  "inputPromptStrength": 1,
  "diffusionGuidanceScale": 3,
  "numberOfInferenceSteps": 50
}

Output

The action typically returns a URL to the generated image.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/b1a3815c-d81e-4773-993a-2cc874eec6c1/f960ad0d-f4bd-4d6b-84d1-98606b3024dc.png"
]

Conceptual Usage Example (Python)

Here’s a conceptual Python code snippet demonstrating how to call the Generate Custom Image action:

import requests
import json

# Replace with your Cognitive Actions API key and endpoint
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute" # Hypothetical endpoint

action_id = "3fea6c32-6f31-4b6e-8167-0ae876b4dcf8" # Action ID for Generate Custom Image

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "goFast": False,
    "prompt": "Ultrarealistic photo of stefbo as a superhero, face uncovered, wearing a futuristic superhero suit...",
    "loraScale": 1,
    "megapixels": "1",
    "numberOfOutputs": 1,
    "imageAspectRatio": "9:16",
    "imageOutputFormat": "png",
    "imageOutputQuality": 100,
    "additionalLoraScale": 1,
    "inputPromptStrength": 1,
    "diffusionGuidanceScale": 3,
    "numberOfInferenceSteps": 50
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json"
}

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json={"action_id": action_id, "inputs": payload} # Hypothetical structure
    )
    response.raise_for_status()

    result = response.json()
    print("Action executed successfully:")
    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: {e.response.text}")

In the snippet above, replace the placeholder values with your actual API key and customize the prompt as needed. The action_id corresponds to the Generate Custom Image action.

Conclusion

The zeg06/stefbo Cognitive Actions empower developers to easily integrate sophisticated image generation capabilities into their applications. By leveraging the Generate Custom Image action, you can create visually stunning content tailored to your specifications. Explore various prompts, models, and configurations to unlock the full potential of your creative projects. Whether for marketing, storytelling, or artistic expression, these Cognitive Actions provide a robust solution for modern image generation needs.