Generate Custom Helldivers Strategem Icons with Cognitive Actions

24 Apr 2025
Generate Custom Helldivers Strategem Icons with Cognitive Actions

In the world of game development, visual appeal plays a crucial role in engaging players. The iamprofessorex/helldivers-strategem-icons API offers a powerful Cognitive Action that allows developers to generate stunning images of Helldivers strategem icons. This action can be customized to suit specific needs, offering flexibility in image size, aspect ratio, and output quality, among other options. By leveraging these pre-built actions, developers can save time and effort while ensuring high-quality visual assets for their applications.

Prerequisites

Before diving into the implementation of the Cognitive Actions, ensure that you have the following prerequisites in place:

  • An API key for accessing the Cognitive Actions platform.
  • Basic knowledge of sending HTTP requests.
  • Familiarity with JSON format for input and output data structures.

Authentication typically involves passing the API key in the request headers to authenticate your calls to the Cognitive Actions service.

Cognitive Actions Overview

Generate Helldivers Strategem Icons

The Generate Helldivers Strategem Icons action allows you to create images of Helldivers strategem icons using the specified model. You can customize various parameters like image size, aspect ratio, and apply optional masking for more precise control over the output. This capability is particularly useful for generating unique game assets tailored to your design specifications.

Input

The input for this action follows a structured schema, which requires a prompt and allows for various optional parameters. Here's a breakdown:

  • prompt (required): A text description guiding the image generation.
  • mask (optional): URI of an image mask for inpainting.
  • seed (optional): A fixed seed for reproducibility in random generation.
  • image (optional): URI of an input image for processing.
  • width (optional): Specifies the width of the generated image (must be a multiple of 16).
  • height (optional): Specifies the height of the generated image (must be a multiple of 16).
  • fastMode (optional): Enables faster predictions at the cost of some quality.
  • loraScale (optional): Controls the intensity of the LoRA application.
  • megapixels (optional): Approximate megapixel count of the image.
  • aspectRatio (optional): Defines the aspect ratio (e.g., "1:1", "16:9").
  • imageFormat (optional): Specifies the output image format (e.g., "webp", "jpg").
  • outputCount (optional): Number of images to generate (1 to 4).
  • guidanceScale (optional): Adjusts the diffusion process scale.
  • outputQuality (optional): Sets the image quality (0 to 100).
  • inferenceModel (optional): Selects the inference model.
  • inferenceSteps (optional): Number of denoising steps.
  • promptStrength (optional): Strength of the prompt influence when using img2img.
  • additionalLoraScale (optional): Determines the strength of additional LoRA application.
  • disableSafetyChecker (optional): Turns off the safety checker for images.

Example Input:

{
  "prompt": "(minimalist icon of a emergency beacon), black background, two-tone design, geometric shapes, cream white and blue colors, HELLDIVERSTRATEGEMICONS style, centered composition, sharp edges, clean vector art, military insignia aesthetic, strategic icon",
  "fastMode": false,
  "loraScale": 1,
  "megapixels": "1",
  "aspectRatio": "1:1",
  "imageFormat": "webp",
  "outputCount": 4,
  "guidanceScale": 3,
  "outputQuality": 80,
  "inferenceModel": "dev",
  "inferenceSteps": 28,
  "promptStrength": 0.8,
  "additionalLoraScale": 1
}

Output

The output of this action consists of an array of URLs pointing to the generated images. Here’s what you can expect:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/0cd13d6e-b536-460d-a879-f17f5560fc7a/ecc8ee21-6d39-4858-b3c1-acdadcb29900.webp",
  "https://assets.cognitiveactions.com/invocations/0cd13d6e-b536-460d-a879-f17f5560fc7a/9d53d256-bb11-44e5-b312-0d905c58915a.webp",
  "https://assets.cognitiveactions.com/invocations/0cd13d6e-b536-460d-a879-f17f5560fc7a/34e4feff-f4bf-458b-b417-42c1ddc898e0.webp",
  "https://assets.cognitiveactions.com/invocations/0cd13d6e-b536-460d-a879-f17f5560fc7a/73724f41-9b76-4622-b761-6e88ee9a8198.webp"
]

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet demonstrating how to invoke the Generate Helldivers Strategem Icons action:

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 = "2afb2fe9-7cf7-4bae-8550-4934da86afbd"  # Action ID for Generate Helldivers Strategem Icons

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "(minimalist icon of a emergency beacon), black background, two-tone design, geometric shapes, cream white and blue colors, HELLDIVERSTRATEGEMICONS style, centered composition, sharp edges, clean vector art, military insignia aesthetic, strategic icon",
    "fastMode": False,
    "loraScale": 1,
    "megapixels": "1",
    "aspectRatio": "1:1",
    "imageFormat": "webp",
    "outputCount": 4,
    "guidanceScale": 3,
    "outputQuality": 80,
    "inferenceModel": "dev",
    "inferenceSteps": 28,
    "promptStrength": 0.8,
    "additionalLoraScale": 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}  # 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, make sure to replace "YOUR_COGNITIVE_ACTIONS_API_KEY" with your actual API key. The payload is constructed following the input schema, ensuring that each required field is populated correctly.

Conclusion

The Generate Helldivers Strategem Icons Cognitive Action provides developers with a robust and customizable tool for generating visual assets. By leveraging its various parameters, you can create unique and high-quality icons that enhance the visual appeal of your applications. Explore the possibilities of integrating this action into your projects, and elevate your game's design with tailored strategem icons!