Create Stunning Images with Stillsuit's Inpainting Action

25 Apr 2025
Create Stunning Images with Stillsuit's Inpainting Action

In the realm of digital content creation, capturing the imagination and conveying stories through visuals is paramount. The Stillsuit service offers a powerful Cognitive Action specifically designed for image generation through inpainting. This feature allows developers to create detailed, customized images by transforming existing visuals or generating new ones based on textual prompts. With options for speed and quality, Stillsuit simplifies the process of producing captivating imagery that meets various artistic and commercial needs.

Common use cases for the Generate Image with Inpainting action include creating illustrations for marketing materials, generating concept art for video games or films, and designing unique visuals for social media posts. Whether you are a game developer looking to visualize characters or a marketer aiming to enhance visual storytelling, this action can significantly streamline your creative workflow.

Prerequisites

To get started with the Stillsuit Cognitive Actions, you will need an API key and some familiarity with making API calls. This will enable you to integrate the image generation capabilities into your applications seamlessly.

Generate Image with Inpainting

The Generate Image with Inpainting action is designed to create visuals by either transforming existing images or generating new ones based on detailed prompts. This action addresses the challenge of producing high-quality imagery quickly and efficiently, allowing developers to focus on their creative vision without getting bogged down by technical limitations.

Input Requirements

To utilize this action, you will need to provide a variety of inputs:

  • Prompt: A textual description of the desired image, which serves as the foundation for generation.
  • Image (optional): An existing image that can be transformed or used for inpainting.
  • Mask (optional): An image mask that defines areas to be modified.
  • Model: Choose between 'dev' for detailed generation or 'schnell' for faster results.
  • Dimensions and Aspect Ratio: Specify the width, height, and aspect ratio for the generated image.
  • Output Count: Number of images to generate (up to 4).
  • Additional parameters such as guidance intensity, output format, and quality settings can also be specified.

Expected Output

The action returns one or more generated images based on the provided inputs. The output includes a URL to the generated image file, which can be used directly in your applications.

Use Cases for this Action

  • Marketing Campaigns: Generate unique visuals that resonate with target audiences, enhancing promotional materials.
  • Concept Art: Rapidly develop character designs or environments for games and films, allowing for quick iterations based on feedback.
  • Social Media Content: Create eye-catching images for posts that stand out in crowded feeds, driving engagement.
import requests
import json

# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"

action_id = "df82c4fb-31f2-46e3-82ae-4968293b0f07" # Action ID for: Generate Image with Inpainting

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "seed": 42,
  "model": "dev",
  "prompt": "The image portrays a character in the 2021 film \"Dune,\" wearing the iconic ST1LLSU1T designed for survival in the harsh desert environment of the planet Arrakis. This photograph captures the character in a crouched position amidst a rocky setting. The ST1LLSU1T is a marvel of practical design and functionality, engineered to conserve and filter the wearer's bodily moisture. The suit is comprised of numerous intricate components, such as hydration tubes running along the body, filters strategically placed at crucial collection points, and a snug, form-fitting material that appears both robust and flexible to allow for mobility and endurance in the brutal desert climate.\n\nThe character's suit is primarily dark in color, varying shades of grey and black which helps it blend seamlessly into the desert rock background. The materials of the ST1LLSU1T likely combine advanced synthetic fabrics and possibly some organic elements, designed to maximize both efficiency in moisture recovery and comfort. The texture of the suit exhibits a rugged and utilitarian aesthetic, evident in the reinforced patches and ribbed sections on the arms and legs, which suggest areas requiring extra protection and durability. There is noticeable wear, indicative of the character's extensive use and adaptation to the extreme conditions of Arrakis.\n\nWrapped around the character's neck and shoulders is a light, sand-colored scarf, adding layers to the attire that offer protection from the sun and sand. The scarf’s soft, woven texture contrasts with the more structured and technical design of the ST1LLSU1T. The lighting in the scene is muted, natural daylight filtering into what seems to be a sheltered segment of the desert, casting subtle shadows and highlights on the suit. This lighting accentuates the detailed construction of the ST1LLSU1T, highlighting its rugged surface and the practical placement of its components.\n\nThe character’s facial expression and body language convey a sense of alertness and determination, reflected in the intense gaze of their striking blue eyes. This eye color is heavily pronounced against the neutral tones of the surrounding environment and the suit, suggesting a significant narrative element in the movie “Dune” related to the use of the spice known as Melange, which turns the eyes blue. Anatomically, the character appears to be young, with a lean and athletic build, emphasizing the suitability and necessity of the ST1LLSU1T’s design for such a physique. The gloves worn by the character are integrated into the suit, with flexible joints and padded areas, likely aids for handling tools and weapons in the harsh terrain.\n\nAs a medium, the photograph is highly detailed, with a sharp focus on the character and the ST1LLSU1T, allowing viewers to appreciate the intricacies of the suit’s design. The composition places the character slightly off-center, with the surrounding rock formations framing them, underscoring the isolation and the challenging environment of Arrakis. The image encapsulates the essence of survival and resilience central to the film’s theme, with the ST1LLSU1T standing out as a critical element in this depiction. The person depicted in the image remains unidentified.",
  "outputCount": 1,
  "loraIntensity": 1,
  "imageAspectRatio": "1:1",
  "guidanceIntensity": 3.5,
  "imageOutputFormat": "webp",
  "imageOutputQuality": 80,
  "inferenceStepCount": 28,
  "additionalLoraIntensity": 0.8
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json",
    # Add any other required headers for the Cognitive Actions API
}

# Prepare the request body for the hypothetical execution endpoint
request_body = {
    "action_id": action_id,
    "inputs": payload
}

print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json=request_body
    )
    response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully. Result:")
    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 (non-JSON): {e.response.text}")
    print("------------------------------------------------")

Conclusion

The Stillsuit's Generate Image with Inpainting action is a versatile tool for developers looking to enhance their creative projects with stunning visuals. By simplifying the image generation process and providing customizable options, this action empowers users to bring their ideas to life efficiently. Whether you're designing for marketing, entertainment, or personal projects, Stillsuit offers a robust solution to meet your image generation needs. Start integrating this powerful action into your workflows today and unlock new creative possibilities!