Create Stunning Custom Images with the specialcarbidetools/scttool Cognitive Action

24 Apr 2025
Create Stunning Custom Images with the specialcarbidetools/scttool Cognitive Action

In the realm of image generation, the specialcarbidetools/scttool API offers powerful capabilities tailored for developers looking to create custom images. One of the standout features is the Generate Custom Image with Inpainting action, which allows users to harness inpainting techniques for producing unique images based on specific prompts. This powerful tool not only simplifies the image creation process but also enhances creativity by enabling adjustments in dimensions, quality, and selected models for varied results.

Prerequisites

Before you dive into using the Cognitive Actions, you'll need to ensure you have the following:

  • An API key for the Cognitive Actions platform.
  • Basic familiarity with making HTTP requests and handling JSON data.

Authentication typically involves passing your API key in the headers of your requests, ensuring secure access to the Cognitive Actions services.

Cognitive Actions Overview

Generate Custom Image with Inpainting

Purpose:
The Generate Custom Image with Inpainting action is designed to create images using inpainting techniques. Users can select between two models, dev and schnell, each optimized for different performance metrics, and customize various parameters such as image dimensions and quality to achieve the desired results.

Input

The input for this action is structured as follows:

  • prompt (required): A text description guiding the image generation.
  • mask (optional): A URI pointing to an image mask for inpainting.
  • seed (optional): An integer for reproducible image generation.
  • image (optional): A URI for an input image if inpainting is used.
  • model (optional): Choose between dev (detailed) or schnell (fast).
  • width (optional): Width of the generated image (only applicable if aspect_ratio is set to custom).
  • height (optional): Height of the generated image (only applicable if aspect_ratio is set to custom).
  • aspectRatio (optional): Aspect ratio for the image (default is 1:1).
  • outputCount (optional): Number of images to generate (1-4).
  • outputFormat (optional): Format of the output images (default is webp).
  • guidanceScale (optional): Controls the guidance scale during image generation.
  • outputQuality (optional): Quality setting for output images (0-100).
  • promptStrength (optional): Strength of the prompt in the generation process.
  • inferenceStepsCount (optional): Number of denoising steps for image generation.
  • primaryLoraStrength (optional): Intensity of primary LoRA application.
  • additionalLoraStrength (optional): Intensity of additional LoRA application.
  • enableFastMode (optional): Activate fast mode for quicker image generation.
  • safetyCheckerDisabled (optional): Option to disable safety checks.

Example Input:

{
  "model": "dev",
  "prompt": "TOK is an endmill with 4 flutes, a 4-inch length of cut, uncoated surface, 10-inch overall length, and a straight shank with a 45-degree helix angle, On a table next to a car engine.",
  "aspectRatio": "1:1",
  "outputCount": 1,
  "outputFormat": "webp",
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "promptStrength": 0.8,
  "inferenceStepsCount": 28,
  "primaryLoraStrength": 1,
  "additionalLoraStrength": 1
}

Output

The action typically returns a list of image URLs in the specified format. Each URL points to the generated image based on the provided prompt and settings.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/23518af4-7bd7-4499-af76-10d316e5da2d/61975552-8d25-4362-825c-4fb9e74f12e3.webp"
]

Conceptual Usage Example (Python)

Here's a conceptual example of how you might call the Generate Custom Image with Inpainting 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 = "6ac88366-f431-42b4-a8ee-474248d6d03a"  # Action ID for Generate Custom Image with Inpainting

# Construct the input payload based on the action's requirements
payload = {
    "model": "dev",
    "prompt": "TOK is an endmill with 4 flutes, a 4-inch length of cut, uncoated surface, 10-inch overall length, and a straight shank with a 45-degree helix angle, On a table next to a car engine.",
    "aspectRatio": "1:1",
    "outputCount": 1,
    "outputFormat": "webp",
    "guidanceScale": 3.5,
    "outputQuality": 90,
    "promptStrength": 0.8,
    "inferenceStepsCount": 28,
    "primaryLoraStrength": 1,
    "additionalLoraStrength": 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, we set up the input payload based on the action’s requirements and make a POST request to the hypothetical Cognitive Actions endpoint. The action ID and input payload are structured according to the schema defined.

Conclusion

The Generate Custom Image with Inpainting action from the specialcarbidetools/scttool API offers a robust and flexible way to create customized images. With its various configuration options, developers can easily integrate this functionality into their applications, whether for artistic endeavors, product visualization, or other creative projects. Explore the capabilities of this action today and see how it can enhance your development toolkit!