Create Stunning Irregular Shapes with the ShapeColor Cognitive Actions

22 Apr 2025
Create Stunning Irregular Shapes with the ShapeColor Cognitive Actions

In the realm of digital art and design, generating unique visuals can be a daunting task. Enter the ShapeColor Cognitive Actions, a powerful API designed to create captivating images of irregular shapes adorned with aesthetic color palettes. Leveraging the SHPCLR style, this service simplifies image generation while providing customizable options for resolution, format, and other parameters. Whether you're an artist, designer, or developer, integrating these pre-built actions into your application can enhance your creative capabilities.

Prerequisites

Before getting started with the ShapeColor Cognitive Actions, ensure you have:

  • Access to the ShapeColor API, which includes obtaining an API key.
  • Familiarity with JSON format for structuring requests and handling responses.
  • A programming environment set up to make HTTP requests, such as Python with the requests library.

Authentication

To authenticate your requests, you will typically pass your API key in the headers of your HTTP requests. This allows you to securely access the Cognitive Actions without exposing sensitive information.

Cognitive Actions Overview

Generate Irregular Shape Art

Description: This action creates beautiful images of irregular shapes using aesthetic color palettes in the SHPCLR style. It is optimized for both speed and quality, allowing for extensive customization options.

Category: image-generation

Input

The input schema for this action requires the following fields:

  • prompt: (string, required) A description of the desired image. For example, "minimalist sleek shapes in the style of SHPCLR".
  • model: (string, optional) Select between "dev" for higher quality or "schnell" for faster outputs. Default is "dev".
  • outputCount: (integer, optional) Specify how many images to generate (1 to 4). Default is 1.
  • imageQuality: (integer, optional) Set the output image quality on a scale from 0 to 100. Default is 80.
  • loraIntensity: (number, optional) Determines the strength of the main LoRA application. Default is 1.
  • inferenceSteps: (integer, optional) Number of denoising steps to use. Default is 28.
  • promptIntensity: (number, optional) Adjust the strength of the prompt when using img2img. Default is 0.8.
  • imageAspectRatio: (string, optional) Define the aspect ratio for the generated image. Default is "1:1".
  • guidanceIntensity: (number, optional) Guidance scale for diffusion. Default is 3.
  • imageOutputFormat: (string, optional) Choose the format for output images (webp, jpg, png). Default is webp.
  • Additional parameters are available for advanced users, such as seed, fastMode, and skipSafetyCheck.

Here’s an example input JSON payload:

{
  "model": "dev",
  "prompt": "minimalist sleek shapes in the style of SHPCLR",
  "outputCount": 4,
  "imageQuality": 90,
  "loraIntensity": 1.2,
  "inferenceSteps": 28,
  "promptIntensity": 0.8,
  "imageAspectRatio": "1:1",
  "guidanceIntensity": 4,
  "imageOutputFormat": "webp",
  "additionalLoraIntensity": 1
}

Output

This action returns an array of URLs pointing to the generated images. Each image is created based on the input parameters provided.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/adff0381-c212-40df-8978-74b9d4884a47/9f55bb74-d01d-4c05-950e-e01a39325cd9.webp",
  "https://assets.cognitiveactions.com/invocations/adff0381-c212-40df-8978-74b9d4884a47/fe165eff-f5da-4bb6-a954-4719ffa02ccf.webp",
  "https://assets.cognitiveactions.com/invocations/adff0381-c212-40df-8978-74b9d4884a47/95427448-38b1-478d-8346-a439cef72f3d.webp",
  "https://assets.cognitiveactions.com/invocations/adff0381-c212-40df-8978-74b9d4884a47/8fc087ff-bb60-4dbb-9024-5a5cfa7d1c7a.webp"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Irregular Shape Art 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 = "45d62796-bad4-419f-8c42-da66cbbf3fff" # Action ID for Generate Irregular Shape Art

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "minimalist sleek shapes in the style of SHPCLR",
    "outputCount": 4,
    "imageQuality": 90,
    "loraIntensity": 1.2,
    "inferenceSteps": 28,
    "promptIntensity": 0.8,
    "imageAspectRatio": "1:1",
    "guidanceIntensity": 4,
    "imageOutputFormat": "webp",
    "additionalLoraIntensity": 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}
    )
    response.raise_for_status()

    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 contains the input parameters for the action, which align with the input schema described earlier. The endpoint URL and request structure are illustrative, so please adjust as necessary based on the actual API documentation.

Conclusion

The ShapeColor Cognitive Actions provide a versatile and powerful tool for generating stunning irregular shapes in various styles. By integrating these actions into your applications, you can unlock new creative possibilities and automate the generation of unique digital art. Explore the parameters to find the perfect balance for your artistic needs, and consider experimenting with different prompts and settings to achieve the best results. Happy coding!