Create Unique Illustrations with SDXL Cognitive Actions

23 Apr 2025
Create Unique Illustrations with SDXL Cognitive Actions

In the ever-evolving world of digital art and design, the "mattismegevand/sdxl-mspaint" Cognitive Actions offer developers a powerful toolset for generating detailed illustrations that capture the nostalgic essence of MS Paint. By leveraging the SDXL model, these actions enable users to create customized images through a variety of parameters, making them ideal for applications ranging from creative projects to commercial use.

Prerequisites

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

  • API Key: You will need an API key for the Cognitive Actions platform to authenticate your requests. This key should be included in the headers of your requests.
  • Basic Understanding of JSON: Familiarity with JSON format will be helpful for structuring your input and understanding the output.

Authentication typically involves passing your API key in the headers of your API requests, ensuring secure access to the Cognitive Actions functionality.

Cognitive Actions Overview

Generate Illustrated Images with SDXL

Description: Create detailed illustrations fine-tuned in the style of MS Paint using the SDXL model. Customize outputs with various options such as image refinement styles, denoising schedules, and classifier-free guidance.

Category: Image Generation

Input

The input for this action consists of several parameters that control the image generation process. Here’s a breakdown of the required and optional fields:

  • prompt (string, required): Text prompt guiding the image generation. Example: "In the style of MSPAINT, A cityscape viewed from a high-rise building with a pool on the rooftop"
  • width (integer, optional): Width of the output image (default: 1024).
  • height (integer, optional): Height of the output image (default: 1024).
  • refineStyle (string, optional): Method to refine the generated image. Options include "no_refiner", "expert_ensemble_refiner", "base_image_refiner" (default: "no_refiner").
  • scheduleType (string, optional): Scheduler algorithm used for image generation (default: "K_EULER").
  • noiseFraction (number, optional): Specifies the fraction of noise to apply, particularly for the "expert_ensemble_refiner" (default: 0.8).
  • loraAdjustment (number, optional): Scale factor for additive LoRA (default: 0.6).
  • outputQuantity (integer, optional): Number of images to generate (default: 1, range: 1 to 4).
  • promptIntensity (number, optional): Influence of the prompt in img2img or inpainting mode (default: 0.8).
  • guidanceAdjustment (number, optional): Scale for guidance using classifier-free methods (default: 7.5).
  • inferenceStepsCount (integer, optional): Specifies the number of denoising steps in the model (default: 50).
  • watermarkApplication (boolean, optional): Option to apply a watermark on generated images (default: true).

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "In the style of MSPAINT, A cityscape viewed from a high-rise building with a pool on the rooftop\n",
  "refineStyle": "no_refiner",
  "scheduleType": "K_EULER",
  "noiseFraction": 0.8,
  "loraAdjustment": 0.6,
  "outputQuantity": 1,
  "promptIntensity": 0.8,
  "guidanceAdjustment": 7.5,
  "inferenceStepsCount": 50,
  "watermarkApplication": true
}

Output

The action typically returns a list of URLs pointing to the generated images.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/e99779c3-24c0-4d73-9cf2-1e3688da066d/7129d059-bae4-4b2a-8c20-134c4fd30a7e.png"
]

Conceptual Usage Example (Python)

Here’s how you might call this action using Python. This example constructs a JSON payload based on the action's requirements and sends a request to a hypothetical Cognitive Actions execution endpoint.

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 = "7434434c-32b9-4540-9aaf-6e5a39f0ca66" # Action ID for Generate Illustrated Images with SDXL

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "In the style of MSPAINT, A cityscape viewed from a high-rise building with a pool on the rooftop\n",
    "refineStyle": "no_refiner",
    "scheduleType": "K_EULER",
    "noiseFraction": 0.8,
    "loraAdjustment": 0.6,
    "outputQuantity": 1,
    "promptIntensity": 0.8,
    "guidanceAdjustment": 7.5,
    "inferenceStepsCount": 50,
    "watermarkApplication": 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 example, replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable contains the structured input required for generating the illustrated images, while the endpoint URL and request structure are illustrative of how to interact with the Cognitive Actions service.

Conclusion

The "mattismegevand/sdxl-mspaint" Cognitive Actions provide developers with an exciting opportunity to create unique illustrations that evoke the classic charm of MS Paint. By leveraging the various configurable options, developers can tailor the image generation process to suit their specific needs. Whether you're building applications for creative expression or commercial use, these actions can significantly enhance your project's visual capabilities. Explore the possibilities and start generating your own illustrated masterpieces today!