Enhance Your Images with Sdxl Adelaide's Inpainting Action

25 Apr 2025
Enhance Your Images with Sdxl Adelaide's Inpainting Action

In the realm of image processing, Sdxl Adelaide stands out as a powerful tool designed to elevate your creative projects through advanced inpainting and img2img techniques. This Cognitive Action allows developers to generate enhanced images with remarkable precision and customization options. Whether you are looking to restore old photos, create stunning visual content for marketing, or generate unique artwork, this service simplifies the process and ensures high-quality results with just a few API calls.

Imagine needing to fill in gaps in an image or creatively alter existing visuals while maintaining their essence. With Sdxl Adelaide's inpainting capabilities, you can efficiently tackle these tasks, saving time and enhancing the overall quality of your visuals. The flexibility to adjust parameters such as prompt strength, output dimensions, and refinement styles empowers developers to create tailored images that meet specific project needs.

Prerequisites

To use the Sdxl Adelaide Cognitive Actions, you will need an API key and a basic understanding of making API calls.

Generate Enhanced Image with Inpainting

The Generate Enhanced Image with Inpainting action is designed to create high-quality images by intelligently filling in or modifying specific areas based on your input. It utilizes advanced techniques to ensure that the output is not only visually appealing but also aligned with your creative vision.

Input Requirements

To use this action, you will provide the following input parameters:

  • Mask (URI): A URI pointing to the input mask used for inpaint mode. Black areas retain their original content, while white areas are processed for inpainting.
  • Seed (Integer): An optional integer to initialize the random number generator for varied outputs.
  • Image (URI): A URI pointing to the input image for either img2img or inpaint mode.
  • Width (Integer): The desired width of the output image in pixels (default is 1024).
  • Height (Integer): The desired height of the output image in pixels (default is 1024).
  • Prompt (String): A textual description of the scene the AI should generate.
  • Refine (String): Specifies the refinement style to be applied after initial generation (options include no_refiner, expert_ensemble_refiner, and base_image_refiner).
  • Lora Scale (Number): Adjusts the scale of the LoRA effect, with a valid range of 0 to 1.
  • Scheduler (String): Selects the algorithm scheduler to be used during generation.
  • Num Outputs (Integer): Defines the number of images to output (1 to 4).
  • Guidance Scale (Number): Determines the intensity of adherence to the prompt (range 1 to 50).
  • Apply Watermark (Boolean): Decides whether to embed a watermark in the generated image (default is true).
  • Negative Prompt (String): Specifies elements to avoid in the image.
  • Prompt Strength (Number): Adjusts the strength of the prompt during img2img or inpaint processes (range 0 to 1).
  • High Noise Fraction (Number): For expert refinement, defines the fraction of noise in the refinement process.
  • Num Inference Steps (Integer): Specifies the number of steps in the denoising process (1 to 500).

Expected Output

The action will produce an array of image URLs, each leading to the generated images based on your input parameters.

Example Output:

  • https://assets.cognitiveactions.com/invocations/8d5190f6-613a-4987-b3ff-d96bc2ed19d3/74aef58b-1722-41e7-903a-16caffaa1cc3.png
  • https://assets.cognitiveactions.com/invocations/8d5190f6-613a-4987-b3ff-d96bc2ed19d3/bb9280ff-de07-40c0-a3ca-7c3ac743c4ae.png
  • https://assets.cognitiveactions.com/invocations/8d5190f6-613a-4987-b3ff-d96bc2ed19d3/78dc40cb-3392-450e-847c-f8caf5621598.png
  • https://assets.cognitiveactions.com/invocations/8d5190f6-613a-4987-b3ff-d96bc2ed19d3/b8afe627-5e65-4384-8e07-28fe25fe0ec4.png

Use Cases for this Action

  • Restoring Old Images: Use inpainting to fill in missing parts of damaged photographs, bringing memories back to life.
  • Creative Design: Generate artwork that requires specific alterations, such as modifying backgrounds or adding elements without starting from scratch.
  • Marketing Materials: Create stunning visuals for advertisements by enhancing product images or creating themed graphics that capture attention.

```python
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 = "fe393b3a-eeb3-45ea-9075-37f844b5a838" # Action ID for: Generate Enhanced 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 = {
  "width": 1200,
  "height": 800,
  "prompt": "a fantasy style portrait painting of a TOK dog in the style of francois boucher oil painting, rpg portrait",
  "refine": "expert_ensemble_refiner",
  "loraScale": 0.81,
  "scheduler": "K_EULER",
  "numOutputs": 4,
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "negativePrompt": "human, frame, text, signature",
  "promptStrength": 0.8,
  "highNoiseFraction": 0.93,
  "numInferenceSteps": 59
}

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
Sdxl Adelaide's inpainting action offers an exceptional blend of flexibility and quality, making it an invaluable tool for developers looking to enhance their image processing capabilities. With customizable parameters and high-quality outputs, this action can cater to a variety of creative needs—from restoring old images to generating unique artwork. 

As you explore the possibilities with Sdxl Adelaide, consider how these Cognitive Actions can streamline your workflows and elevate your projects to new heights. Start integrating this powerful tool into your applications today!