Create Stunning Artworks with Hiroshi Nagai Style Images using Cognitive Actions

22 Apr 2025
Create Stunning Artworks with Hiroshi Nagai Style Images using Cognitive Actions

In the world of digital art, the ability to generate unique and visually captivating images has gained significant traction. The doriandarko/sdxl-hiroshinagai Cognitive Actions provide developers with powerful tools to create images in the distinctive style of Hiroshi Nagai, utilizing the SDXL model. These actions enable you to generate mesmerizing artwork by analyzing and recognizing patterns from Nagai's illustrations. With features like img2img and inpaint modes, customizable options for mask inputs, and various refinement styles, these actions can enhance your applications' creative capabilities.

Prerequisites

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

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Basic knowledge of making HTTP requests and handling JSON data.

Authentication typically involves passing your API key in the request headers, allowing you to securely access the Cognitive Actions.

Cognitive Actions Overview

Generate Hiroshi Nagai Style Images

The Generate Hiroshi Nagai Style Images action allows you to create images that embody the unique aesthetic of Hiroshi Nagai. This action supports img2img and inpainting, enabling you to refine existing images or generate new ones based on textual prompts.

Input

The input for this action consists of several fields, which can be provided in a JSON object. Here’s a breakdown of the required and optional fields:

  • prompt (string): The textual input guiding image generation. (Example: "In the style of HISGH. A mid-century modern house with a pool, surrounded by palm trees")
  • width (integer): Output image width in pixels. (Default: 1024)
  • height (integer): Output image height in pixels. (Default: 1024)
  • refine (string): Selects the refinement method. (Options: "no_refiner", "expert_ensemble_refiner", "base_image_refiner"; Default: "no_refiner")
  • loraScale (number): LoRA additive scale factor. (Range: 0 to 1; Default: 0.6)
  • scheduler (string): Scheduling algorithm for image generation. (Default: "K_EULER")
  • guidanceScale (number): Scaling factor for guidance. (Range: 1 to 50; Default: 7.5)
  • applyWatermark (boolean): Indicates if a watermark should be applied. (Default: true)
  • negativePrompt (string): Styles or themes to avoid. (Example: "Gothic, Medieval, Abstract, ...")
  • promptStrength (number): Strength of the prompt when using img2img or inpaint modes. (Range: 0 to 1; Default: 0.8)
  • numberOfOutputs (integer): Number of images to generate. (Default: 1; Maximum: 4)
  • highNoiseFraction (number): Fraction of noise for refinement. (Range: 0 to 1; Default: 0.8)
  • numberOfInferenceSteps (integer): Total denoising steps to perform. (Range: 1 to 500; Default: 50)

Here’s an example input JSON payload for this action:

{
  "width": 1024,
  "height": 1024,
  "prompt": "In the style of HISGH. A mid-century modern house with a pool, surrounded by palm trees",
  "refine": "no_refiner",
  "loraScale": 0.6,
  "scheduler": "K_EULER",
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "negativePrompt": "Gothic, Medieval, Abstract, Futuristic, Rustic, Victorian, Graffiti, Fantasy, Horror, Industrial, Cubism, Impressionism, Surrealism, Baroque, Renaissance, Expressionism, Pop-art, Dystopian, Steampunk, Cyberpunk, Ugly, Bad proportion, Distorted, Cluttered, Chaotic, Mismatched, Overcrowded, Imbalanced, Inharmonious, Disproportionate, Unpleasant, Grungy, Messy, Unrefined, Crude, Grotesque, Disarray, Jumbled, Haphazard, Unsymmetrical",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "highNoiseFraction": 0.8,
  "numberOfInferenceSteps": 50
}

Output

Upon successfully executing this action, you will receive a response containing the generated image(s). An example output is as follows:

[
  "https://assets.cognitiveactions.com/invocations/e6c824a8-edb0-4597-a19b-392c5747fd10/ac177e2f-64cf-4e50-b294-77ab9f0cb8bf.png"
]

This output is an array of URLs pointing to the generated images.

Conceptual Usage Example (Python)

Here is a conceptual Python code snippet demonstrating how to call the Cognitive Actions execution endpoint for this 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 = "6ffe9c5b-cef6-47b0-ba4f-9e55357e6fef"  # Action ID for Generate Hiroshi Nagai Style Images

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "In the style of HISGH. A mid-century modern house with a pool, surrounded by palm trees",
    "refine": "no_refiner",
    "loraScale": 0.6,
    "scheduler": "K_EULER",
    "guidanceScale": 7.5,
    "applyWatermark": True,
    "negativePrompt": "Gothic, Medieval, Abstract, Futuristic...",
    "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 snippet:

  • Replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key.
  • The action ID is hardcoded, and the payload is structured according to the input schema detailed above.
  • The results will print the URLs of the generated images.

Conclusion

The doriandarko/sdxl-hiroshinagai Cognitive Actions empower developers to leverage the artistic style of Hiroshi Nagai in their applications. With customizable parameters, you can experiment with various artistic prompts and refinement options to generate stunning visuals. Consider integrating these actions into your projects to enhance user engagement and creativity!