Generate Stunning Bluey Style Images with Cognitive Actions

24 Apr 2025
Generate Stunning Bluey Style Images with Cognitive Actions

In the world of image generation, the jschoormans/sdxl-bluey API offers a powerful tool for developers looking to create unique and engaging visuals. The main action available, Generate Bluey Style Images, allows users to harness advanced techniques to produce custom images in the beloved Bluey style. With features like inpaint mode, img2img conversion, and numerous adjustable parameters, you can achieve precise control over the final output, making it an ideal choice for creative projects.

Prerequisites

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

  • An API key for accessing the Cognitive Actions platform.
  • Basic understanding of HTTP requests and JSON payloads.
  • Familiarity with Python or any programming language that can make HTTP requests.

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

Cognitive Actions Overview

Generate Bluey Style Images

Description: Create custom images in the style of Bluey using advanced image generation techniques. Utilize inpaint mode, img2img conversion, and apply various refinements and noise levels to achieve high-quality outputs.

Category: Image Generation

Input

The input payload for this action is a JSON object that allows for a range of parameters:

  • mask: (string, optional) URI of the input mask used in inpaint mode.
  • seed: (integer, optional) Random seed for image generation.
  • image: (string, optional) URI of the input image for use in img2img or inpaint mode.
  • width: (integer, default: 1024) Desired width of the output image in pixels.
  • height: (integer, default: 1024) Desired height of the output image in pixels.
  • prompt: (string, default: "An astronaut riding a rainbow unicorn") Text prompt to guide image generation.
  • refine: (string, default: "no_refiner") Select the refinement style to apply.
  • loraScale: (number, default: 0.6) Specifies LoRA additive scale.
  • scheduler: (string, default: "K_EULER") Scheduler type for image generation.
  • guidanceScale: (number, default: 7.5) Scale factor for classifier-free guidance.
  • applyWatermark: (boolean, default: true) If true, applies a watermark to the generated images.
  • negativePrompt: (string, default: "") Provide a negative prompt to specify what to avoid.
  • promptStrength: (number, default: 0.8) Defines the prompt strength for img2img or inpaint operations.
  • numberOfOutputs: (integer, default: 1) Specifies the number of images to generate.
  • highNoiseFraction: (number, default: 0.8) Fraction of noise applied in refinement.
  • numberOfInferenceSteps: (integer, default: 50) Specifies the number of denoising steps.

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "In the style of TOK, a dog ",
  "refine": "no_refiner",
  "loraScale": 0.6,
  "scheduler": "K_EULER",
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "highNoiseFraction": 0.8,
  "numberOfInferenceSteps": 50
}

Output

The output from this action will typically be a URL pointing to the generated image.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/6f3f049e-57cc-4976-a036-4b436af1d6f8/308b1d9c-f46f-4c3c-9208-61763aaa04f4.png"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Bluey Style 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 = "2196b6a0-cc4b-4ba2-acaf-043c0ed4317d"  # Action ID for Generate Bluey Style Images

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "In the style of TOK, a dog ",
    "refine": "no_refiner",
    "loraScale": 0.6,
    "scheduler": "K_EULER",
    "guidanceScale": 7.5,
    "applyWatermark": True,
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "highNoiseFraction": 0.8,
    "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()  # 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 payload variable is constructed according to the input requirements, and the action ID is provided for the specific action. The endpoint URL and request structure shown are illustrative; ensure you refer to the actual API documentation for precise details.

Conclusion

The jschoormans/sdxl-bluey Cognitive Actions provide an exciting opportunity for developers looking to enhance their applications with stunning image generation capabilities. With adjustable parameters and advanced features, you can create unique visuals that resonate with users. Consider exploring additional use cases, such as integrating these generated images into games, educational tools, or social media content, to fully leverage the potential of these powerful actions.