Transform Your Images with jyoung105 Instant Style Control Cognitive Actions

23 Apr 2025
Transform Your Images with jyoung105 Instant Style Control Cognitive Actions

The jyoung105/instant-style-control API offers robust capabilities for developers looking to generate styled images based on textual prompts. With its integration of the ControlNet framework, this set of Cognitive Actions allows for high fidelity and flexible image generation, making it ideal for creative applications in art, design, and content creation. By using these pre-built actions, developers can streamline the process of generating customized images that adhere to specific style and composition requirements.

Prerequisites

Before using the Cognitive Actions, ensure you have the following:

  • An API key for the Cognitive Actions platform.
  • A basic understanding of JSON and how to make HTTP requests.

Authentication can typically be handled by including the API key in the request headers, allowing secure access to the Cognitive Actions.

Cognitive Actions Overview

Generate Styled Image with Text-to-Image Control

Description: This action utilizes the ControlNet framework to produce style-preserving images based on textual descriptions. It allows users to adjust style and structure strengths to ensure the characteristics of the desired output are captured effectively.

  • Category: Image Generation

Input

The input for this action requires several parameters:

  • seed (integer, optional): Specifies the random seed. Leave empty for a randomized seed.
  • prompt (string, required): Describes the desired scene or object in detail.
    Example: "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
  • styleImage (string, required): URI pointing to the reference image that defines the style.
    Example: "https://replicate.delivery/pbxt/KhuVS13nzXsU2rMYgEdlcJpNAmEiwP6U8SynbW2TKDyjQOoO/f66790d6bcbc4d529479540bec1b9f1e_06b38be3804e49e789f32fcdde1b576d.png"
  • controlImage (string, required): URI for the composition reference image.
    Example: "https://replicate.delivery/pbxt/KhuVSESWxoUIHzU1pajEJGrE7aZOTpbxm23JbLI4XMWl5JnS/33ef158a8a6247d0a058046c66a0c0c0_496baaa7f7cc4587989b6e967c354a56.png"
  • negativePrompt (string, optional): Aspects to avoid in the output.
    Example: "ugly, deformed, disfigured, poor details, bad anatomy"
  • styleInfluence (number, optional): Determines the influence of the style reference (0 to 2).
    Default: 0.9
  • numberOfOutputs (integer, optional): Specifies how many output images to generate (1 to 4).
    Default: 1
  • imageReferenceMode (string, optional): How the image reference is used: 'original', 'style-only', 'style-and-layout'.
    Default: "style-only"
  • structureInfluence (number, optional): Structural influence strength (0 to 2).
    Default: 1.1
  • guidanceScaleFactor (number, optional): Scaling factor for guidance (1 to 20).
    Default: 1
  • imageAdaptationMode (string, optional): Determines adaptation mode: 'original' or 'plus'.
    Default: "original"
  • negativeInfluenceScale (number, optional): Strength of negative content exclusion (0 to 1).
    Default: 0.5
  • numberOfInferenceSteps (integer, optional): Number of steps in the denoising process (1 to 50).
    Default: 8

Example Input

{
  "prompt": "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
  "styleImage": "https://replicate.delivery/pbxt/KhuVS13nzXsU2rMYgEdlcJpNAmEiwP6U8SynbW2TKDyjQOoO/f66790d6bcbc4d529479540bec1b9f1e_06b38be3804e49e789f32fcdde1b576d.png",
  "controlImage": "https://replicate.delivery/pbxt/KhuVSESWxoUIHzU1pajEJGrE7aZOTpbxm23JbLI4XMWl5JnS/33ef158a8a6247d0a058046c66a0c0c0_496baaa7f7cc4587989b6e967c354a56.png",
  "negativePrompt": "ugly, deformed, disfigured, poor details, bad anatomy",
  "styleInfluence": 1,
  "numberOfOutputs": 1,
  "imageReferenceMode": "original",
  "useNegativeContent": false,
  "guidanceScaleFactor": 1,
  "imageAdaptationMode": "original",
  "negativeInfluenceScale": 0.5,
  "numberOfInferenceSteps": 10
}

Output

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

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/7c05effc-6db2-432e-9ce2-9599f3462d2a/261bac6b-5da6-48a9-8773-ba2d04aeb700.png"
]

Conceptual Usage Example (Python)

Here’s how you might call the Cognitive Actions endpoint to generate a styled image:

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 = "03094356-a784-4269-afc5-9d6336176f41"  # Action ID for Generate Styled Image with Text-to-Image Control

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k",
    "styleImage": "https://replicate.delivery/pbxt/KhuVS13nzXsU2rMYgEdlcJpNAmEiwP6U8SynbW2TKDyjQOoO/f66790d6bcbc4d529479540bec1b9f1e_06b38be3804e49e789f32fcdde1b576d.png",
    "controlImage": "https://replicate.delivery/pbxt/KhuVSESWxoUIHzU1pajEJGrE7aZOTpbxm23JbLI4XMWl5JnS/33ef158a8a6247d0a058046c66a0c0c0_496baaa7f7cc4587989b6e967c354a56.png",
    "negativePrompt": "ugly, deformed, disfigured, poor details, bad anatomy",
    "styleInfluence": 1,
    "numberOfOutputs": 1,
    "imageReferenceMode": "original",
    "useNegativeContent": False,
    "guidanceScaleFactor": 1,
    "imageAdaptationMode": "original",
    "negativeInfluenceScale": 0.5,
    "numberOfInferenceSteps": 10
}

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 the API key and endpoint with your actual credentials. The action ID and structured input payload must align with the specifications outlined above.

Conclusion

The jyoung105/instant-style-control Cognitive Actions provide developers with powerful tools to generate styled images that meet specific creative demands. By leveraging these capabilities, you can enhance your applications with dynamic and visually appealing content. Explore the possibilities of image generation, and consider how you can integrate these actions into your projects for stunning results!