Create Stunning Images with the fofr/ultrapixel Cognitive Actions

22 Apr 2025
Create Stunning Images with the fofr/ultrapixel Cognitive Actions

In the world of digital content creation, high-quality imagery can make a significant difference. The fofr/ultrapixel API offers a powerful Cognitive Action designed to generate ultra high-resolution images. Utilizing the advanced Stable Cascade model, this action enables developers to create images up to 4096x4096 pixels, enhancing detail and quality for various applications. Whether you're building a creative platform, developing an art generator, or just want to improve your visual assets, this tool can streamline your workflow and elevate your project's visual appeal.

Prerequisites

Before you start using the Cognitive Actions, ensure you have the following:

  • API Key: You will need an API key to authenticate your requests with the Cognitive Actions platform. This key should be passed in the request headers for authentication.
  • Basic Understanding of JSON: Familiarity with JSON will help you structure your requests effectively.

Cognitive Actions Overview

Generate Ultra High Resolution Images

The Generate Ultra High Resolution Images action allows you to create stunning images based on descriptive prompts. It is categorized under image-generation and is ideal for developers looking to produce high-quality visuals.

Input

The input for this action requires several parameters to define the image to be generated:

  • seed (optional): An integer to set for reproducibility. If not provided, a random seed will be used.
  • width: The width of the output image in pixels (default: 2048, min: 1024, max: 5120).
  • height: The height of the output image in pixels (default: 2048, min: 1024, max: 5120).
  • prompt: A descriptive string that specifies what the image should depict.
  • stageBCfg: A float that configures Stage B (default: 1.1, min: 0.1, max: 10).
  • stageCCfg: A float that configures Stage C (default: 4, min: 0.1, max: 10).
  • stageBSteps: An integer representing the number of steps in Stage B (default: 10, min: 1, max: 50).
  • stageCSteps: An integer representing the number of steps in Stage C (default: 20, min: 1, max: 50).
  • outputFormat: Specifies the format of the output images (options: webp, jpg, png; default: webp).
  • outputQuality: An integer for the quality of the output images (default: 80, min: 0, max: 100).
  • controlNetWeight: A float that influences the Controlnet weight (default: 0.7, min: 0.1, max: 1).
  • cannyControlImage (optional): A URI for an optional control image for Canny Controlnet.

Example Input

Here’s a sample JSON payload to invoke this action:

{
  "width": 2048,
  "height": 2048,
  "prompt": "Spiderpunk woman, Cinematic 8k HDR, Anime Eyes, artwork by Ilya Kuvshinov",
  "stageBCfg": 1.1,
  "stageCCfg": 4,
  "stageBSteps": 10,
  "stageCSteps": 20,
  "outputFormat": "webp",
  "outputQuality": 90,
  "controlNetWeight": 1
}

Output

Upon successful execution, the action will return a URL link to the generated image. Here’s an example of what the response looks like:

[
  "https://assets.cognitiveactions.com/invocations/b23aaea0-c5d2-4870-b054-91cfc71915bf/e3fe044b-385c-4d13-b819-8ed763681977.webp"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Ultra High Resolution Images action using Python:

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 = "a6a3f746-e121-43f5-9e09-eaf9b3f528fe" # Action ID for Generate Ultra High Resolution Images

# Construct the input payload based on the action's requirements
payload = {
    "width": 2048,
    "height": 2048,
    "prompt": "Spiderpunk woman, Cinematic 8k HDR, Anime Eyes, artwork by Ilya Kuvshinov",
    "stageBCfg": 1.1,
    "stageCCfg": 4,
    "stageBSteps": 10,
    "stageCSteps": 20,
    "outputFormat": "webp",
    "outputQuality": 90,
    "controlNetWeight": 1
}

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() # Raise an exception for bad status codes (4xx or 5xx)

    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 this code snippet, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The action_id corresponds to the Generate Ultra High Resolution Images action, and the payload contains the necessary input parameters. The response will include the URL of the generated image.

Conclusion

The fofr/ultrapixel Cognitive Action for generating ultra high-resolution images presents an excellent opportunity for developers to enhance their applications with stunning visuals. By leveraging this powerful tool, you can create detailed and high-quality images tailored to your specific needs. Explore the possibilities of integrating this action into your projects, and elevate your content to new heights!