Enhance Your Images with the cottom/xsd_12kdsd Cognitive Actions

22 Apr 2025
Enhance Your Images with the cottom/xsd_12kdsd Cognitive Actions

In the world of digital imagery, enhancing images can be crucial for various applications, from creating stunning visuals for marketing to improving the quality of images in apps. The cottom/xsd_12kdsd Cognitive Actions provide a powerful toolset for developers to generate enhanced images from grayscale inputs using ControlNet. By leveraging these pre-built actions, developers can easily integrate advanced image processing capabilities into their applications, allowing for customization in terms of resolution, style, and more.

Prerequisites

Before diving into the integration of Cognitive Actions, ensure you have the following:

  • An API key for the Cognitive Actions platform.
  • Familiarity with making HTTP requests in your preferred programming language (e.g., Python).
  • Basic understanding of JSON payloads, as you will be crafting these to invoke the actions.

For authentication, the API key will typically be passed in the request headers, allowing you to securely access the Cognitive Actions.

Cognitive Actions Overview

Generate Enhanced Image

The Generate Enhanced Image action transforms grayscale input images into enhanced versions. By customizing parameters such as resolution, inference steps, and style, developers can achieve the desired enhancements to their images.

Input

The input for this action requires a JSON object structured according to the following schema:

  • image (string, required): URI of the grayscale input image.
  • dryRun (boolean, optional): Indicates whether to perform a dry run without making changes. Default is false.
  • prompt (string, optional): A text prompt to generate content. Default is an empty string.
  • guidanceScale (number, optional): A scale factor for ControlNet conditioning (0 to 10). Default is 2.
  • schedulerType (string, optional): Type of scheduler during inference. Default is K_EULER.
  • conditionScale (number, optional): Scale for conditional generation (0 to 1). Default is 0.5.
  • negativePrompt (string, optional): Specifies aspects to avoid in the generated content.
  • imageResolution (integer, optional): The resolution (128 to 4096 pixels) for processing. Default is 1024.
  • detectResolution (integer, optional): The resolution for detection methods (128 to 4096 pixels). Default is 512.
  • numInferenceSteps (integer, optional): Number of steps during inference (1 to 100). Default is 30.
  • enableDepthControl (boolean, optional): Flag to enable depth control. Default is true.
  • numImagesPerPrompt (integer, optional): Number of images to generate per prompt (1 to 9). Default is 1.
  • enableSketchControl (boolean, optional): Flag to enable sketch control. Default is true.
  • imageStyleReference (string, optional): URI of the input image style reference.
Example Input
{
  "image": "https://replicate.delivery/pbxt/Jeys9hsouLzzzHHSLnCCiNU5httOBXz7uv5kEKLp7i440naF/output_0%20%281%29.png",
  "dryRun": false,
  "prompt": "A photo of a room, 4k photo, highly detailed",
  "guidanceScale": 7.5,
  "conditionScale": 1,
  "negativePrompt": "anime, cartoon, graphic, text, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured",
  "imageResolution": 1024,
  "detectResolution": 512,
  "numInferenceSteps": 30,
  "enableDepthControl": true,
  "numImagesPerPrompt": 1,
  "enableSketchControl": true
}

Output

The action typically returns an array of URIs pointing to the enhanced images generated.

Example Output
[
  "https://assets.cognitiveactions.com/invocations/537fee8c-68f7-4a04-bd7f-105f879212a2/25677899-3cd2-44ec-bcdf-40b8587cd5b0.png"
]

Conceptual Usage Example (Python)

Here's how you might call the Generate Enhanced Image 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 = "7278990e-978d-4598-8f19-1387fc21196a" # Action ID for Generate Enhanced Image

# Construct the input payload based on the action's requirements
payload = {
    "image": "https://replicate.delivery/pbxt/Jeys9hsouLzzzHHSLnCCiNU5httOBXz7uv5kEKLp7i440naF/output_0%20%281%29.png",
    "dryRun": false,
    "prompt": "A photo of a room, 4k photo, highly detailed",
    "guidanceScale": 7.5,
    "conditionScale": 1,
    "negativePrompt": "anime, cartoon, graphic, text, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured",
    "imageResolution": 1024,
    "detectResolution": 512,
    "numInferenceSteps": 30,
    "enableDepthControl": true,
    "numImagesPerPrompt": 1,
    "enableSketchControl": true
}

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 Python snippet, replace the COGNITIVE_ACTIONS_API_KEY and the endpoint URL with your actual credentials. The action_id corresponds to the Generate Enhanced Image action, and the payload is structured according to the required input schema.

Conclusion

The cottom/xsd_12kdsd Cognitive Actions provide a robust means of enhancing images with minimal effort. By utilizing the Generate Enhanced Image action, developers can create visually compelling images tailored to their specific needs. Consider experimenting with various parameters to see the full potential of this action in your applications. Happy coding!