Enhance Your Images with the ryokeken/beetlesdoll Cognitive Actions

25 Apr 2025
Enhance Your Images with the ryokeken/beetlesdoll Cognitive Actions

In the world of image processing, the ability to manipulate and enhance images is crucial for developers looking to create engaging applications. The ryokeken/beetlesdoll Cognitive Actions provide robust image transformation capabilities, allowing you to generate modified images based on input specifications. With features like inpainting, customizable properties, and fast generation options, these actions empower developers to create stunning visuals with ease.

Prerequisites

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

  • An API key for the Cognitive Actions platform.
  • Basic knowledge of making API calls and handling JSON data.

Authentication typically involves including your API key in the headers of your requests. This allows you to securely access the Cognitive Actions and utilize their powerful capabilities.

Cognitive Actions Overview

Generate Inpainting Image

Description:
This action creates an enhanced or modified image from a provided source image using an optional inpainting mode. You can customize properties such as aspect ratio, resolution, and output format. The action supports fast generation and enables fine-tuning with various LoRA models and settings.

Category: image-processing

Input

The input for this action is structured as follows:

{
  "prompt": "beetlesdoll playing the guitar on a white background ",
  "model": "dev",
  "aspectRatio": "1:1",
  "imageFormat": "jpg",
  "outputCount": 1,
  "imageQuality": 90,
  "mainLoraScale": 1,
  "denoisingSteps": 28,
  "additionalLoraScale": 1,
  "imagePromptStrength": 0.8,
  "diffusionGuidanceScale": 3.5
}
  • Required Fields:
    • prompt: A textual description that guides the image generation.
  • Optional Fields:
    • model: Select the inference model (dev or schnell).
    • aspectRatio: Set the image aspect ratio (e.g., 1:1, 16:9).
    • imageFormat: Choose the output format (webp, jpg, png).
    • outputCount: Specify the number of images to generate (1-4).
    • imageQuality: Define the quality of the output images (0-100).
    • Additional parameters for fine-tuning the generation can also be included, such as mainLoraScale, denoisingSteps, imagePromptStrength, and diffusionGuidanceScale.

Output

The output of the action typically returns a URL to the generated image. For example:

[
  "https://assets.cognitiveactions.com/invocations/90a3b6b1-fba3-45c0-a5a3-89578ad647ec/66f6c2ff-07f9-47d1-b32f-1f6845539465.jpg"
]

This output provides a direct link to the newly created image based on the input parameters.

Conceptual Usage Example (Python)

Here's how you might call the Generate Inpainting 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 = "4679a9ab-f0fb-4bc2-b2e4-a69b383599df" # Action ID for Generate Inpainting Image

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "beetlesdoll playing the guitar on a white background ",
    "aspectRatio": "1:1",
    "imageFormat": "jpg",
    "outputCount": 1,
    "imageQuality": 90,
    "mainLoraScale": 1,
    "denoisingSteps": 28,
    "additionalLoraScale": 1,
    "imagePromptStrength": 0.8,
    "diffusionGuidanceScale": 3.5
}

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 the placeholder API key and endpoint with your actual details. The input payload is constructed according to the action's requirements, and the request is sent to the hypothetical endpoint. The response is then processed to display the resulting image URL.

Conclusion

The ryokeken/beetlesdoll Cognitive Actions unlock a world of possibilities for image processing and enhancement. By leveraging the power of these pre-built actions, developers can easily integrate advanced image generation features into their applications. Whether you’re creating art, designing marketing materials, or developing games, these actions can significantly enhance your workflow. Explore these capabilities today and transform the way you handle images in your projects!