Create Stunning Custom Images with johnseepps/hoodicon Cognitive Actions

25 Apr 2025
Create Stunning Custom Images with johnseepps/hoodicon Cognitive Actions

In the world of artificial intelligence and image generation, the johnseepps/hoodicon Cognitive Actions provide developers with powerful tools to create visually stunning images tailored to specific prompts. These actions leverage advanced inpainting techniques to produce customized images, offering flexibility in settings and control over the artistic output. By utilizing these pre-built actions, developers can streamline the process of generating unique visuals for applications ranging from creative artwork to product design.

Prerequisites

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

  • An API key for accessing the Cognitive Actions platform.
  • Familiarity with making HTTP requests in your programming language of choice.
  • Basic knowledge of JSON to structure your requests correctly.

For authentication, you will typically pass the API key in the headers of your request, allowing you to securely access the Cognitive Actions features.

Cognitive Actions Overview

Generate Custom Inpainted Image

The Generate Custom Inpainted Image action allows you to create unique images by inpainting with two model options: schnell for speed and dev for quality. This action supports a variety of settings, including inputs for images and masks, adjustable dimensions, and prompt-driven generation. Developers can also utilize advanced settings for nuanced artistic control.

Input

The input schema for this action is as follows:

{
  "prompt": "string",
  "width": "integer (optional)",
  "height": "integer (optional)",
  "imageMask": "string (optional, uri)",
  "modelType": "string (default: 'dev')",
  "inputImage": "string (optional, uri)",
  "randomSeed": "integer (optional)",
  "imageFormat": "string (default: 'webp')",
  "outputCount": "integer (default: 1)",
  "weightScale": "number (default: 1)",
  "imageQuality": "integer (default: 80)",
  "enableFastMode": "boolean (default: false)",
  "imageMegapixels": "string (default: '1')",
  "promptIntensity": "number (default: 0.8)",
  "imageAspectRatio": "string (default: '1:1')",
  "additionalWeights": "string (optional)",
  "guidanceIntensity": "number (default: 3)",
  "inferenceStepCount": "integer (default: 28)",
  "initializedWeights": "string (optional)",
  "additionalWeightScale": "number (default: 1)",
  "safetyCheckerDisabled": "boolean (default: false)"
}

Example Input:

{
  "prompt": "Hood Guru in a playful, slightly out-of-focus shot taken in front of a full-length mirror, capturing Hood Guru adjusting his outfit. Wearing a sharp, fitted jacket over bare skin, Hood Guru has platinum blonde dreadlocks styled messily. The gold-framed reading glasses are sitting perfectly on Hood Guru's nose, adding a touch of class to the candid moment. The photo has a natural, unfiltered look, with a bit of motion blur as Hood Guru adjusts his jacket, giving it an authentic, in-the-moment feel.",
  "modelType": "dev",
  "imageFormat": "jpg",
  "outputCount": 2,
  "weightScale": 1,
  "imageQuality": 80,
  "imageAspectRatio": "16:9",
  "guidanceIntensity": 2.5,
  "inferenceStepCount": 28,
  "additionalWeightScale": 0.8
}

Output

The action typically returns a list of URIs for the generated images.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/d1a577da-3e83-461c-9313-2f1f230cc672/902a716d-6604-41c5-9349-ba9ca5852d7c.jpg",
  "https://assets.cognitiveactions.com/invocations/d1a577da-3e83-461c-9313-2f1f230cc672/553e775c-c109-4cc1-826d-56e6e33fd843.jpg"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Custom Inpainted 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 = "fbc21c53-4c4e-4f5c-8030-58be34f85a17"  # Action ID for Generate Custom Inpainted Image

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "Hood Guru in a playful, slightly out-of-focus shot taken in front of a full-length mirror, capturing Hood Guru adjusting his outfit. Wearing a sharp, fitted jacket over bare skin, Hood Guru has platinum blonde dreadlocks styled messily. The gold-framed reading glasses are sitting perfectly on Hood Guru's nose, adding a touch of class to the candid moment. The photo has a natural, unfiltered look, with a bit of motion blur as Hood Guru adjusts his jacket, giving it an authentic, in-the-moment feel.",
    "modelType": "dev",
    "imageFormat": "jpg",
    "outputCount": 2,
    "weightScale": 1,
    "imageQuality": 80,
    "imageAspectRatio": "16:9",
    "guidanceIntensity": 2.5,
    "inferenceStepCount": 28,
    "additionalWeightScale": 0.8
}

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, you replace the API key and endpoint with your own. The payload is structured according to the action's input schema, ensuring that all required fields are included. The response is then processed to display the generated image URIs.

Conclusion

The johnseepps/hoodicon Cognitive Actions offer developers a robust framework for generating custom images with a high degree of flexibility and creative control. By utilizing the Generate Custom Inpainted Image action, you can effortlessly create unique visuals tailored to your specifications. Explore how you can integrate these capabilities into your applications, enhancing user experiences and unlocking new creative possibilities!