Create Stunning Images with Brunadepaula's Inpainting Action

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

In the world of digital content creation, high-quality images are essential for capturing attention and conveying messages effectively. With Brunadepaula's Cognitive Actions, developers can harness the power of advanced image generation techniques, particularly through the Generate Custom Image with Inpainting action. This innovative tool allows you to create stunning, high-resolution images tailored to your specific needs, offering flexibility in terms of model settings, aspect ratios, and more.

Whether you're a developer looking to enhance your application's visual appeal or an artist aiming to produce unique artwork, Brunadepaula's inpainting capabilities simplify the image generation process. Imagine generating ultra-realistic portraits, artistic illustrations, or custom visuals for marketing campaigns—all at the click of a button. The ability to adjust parameters such as resolution, quality, and model selection ensures that you can achieve the desired aesthetic quickly and efficiently.

Prerequisites

To get started with Brunadepaula's Cognitive Actions, you'll need an API key for accessing the service and a basic understanding of making API calls.

Generate Custom Image with Inpainting

The Generate Custom Image with Inpainting action enables you to create high-quality images utilizing inpainting and image-to-image conversion techniques. This function is particularly useful for situations where you want to enhance or modify existing images seamlessly.

Purpose

This action allows developers to generate images with specific attributes, solving the problem of creating unique visuals that meet particular requirements. Whether you need a new version of an existing image or want to generate an entirely new concept, this action has you covered.

Input Requirements

To use this action, you must provide a prompt that guides the image generation process. Additional optional parameters can enhance the outcome, including:

  • mask: A URI for an image mask used in inpainting mode.
  • image: A URI for the input image when using image-to-image generation.
  • width and height: Dimensions for the generated image (only applicable when using a custom aspect ratio).
  • imageFormat: The desired output format (e.g., webp, jpg, png).
  • inferenceModel: Selects which model to use for inference.
  • loraIntensity: Adjusts the strength of LoRA model weights.

Expected Output

The action returns a high-quality image URL that can be used directly in applications or for further editing. For instance, the output might look like this:

  • https://assets.cognitiveactions.com/invocations/b83dbe58-40a0-49a8-90da-309d10870420/38a6161c-f4ab-40ca-b10d-34b0cfe9f147.webp

Use Cases for this Specific Action

  • Marketing Campaigns: Generate eye-catching visuals tailored to specific themes or products.
  • Artistic Projects: Create unique artwork by modifying existing images or generating new ones based on detailed prompts.
  • E-commerce: Enhance product images or create visuals that better represent the brand's identity.
  • Social Media: Develop custom images for posts, stories, or promotional content that stand out in feeds.
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 = "a55679dc-1160-4402-a047-81e679a89a92" # Action ID for: Generate Custom 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 = {
  "mask": "https://replicate.delivery/pbxt/MlwegYrc9RFuQrReZTwkYnoT9dkVt1ATEqxs2XHk2cSSsg46/ana_site-1.jpg",
  "prompt": "brunadepaula Ultra-realistic, high-quality studio portrait, wearing a black turtleneck sweater. She has a confident and charismatic expression that conveys intelligence and approachability. Her eyes are well-lit, creating an engaging and expressive gaze.\n\nShe is leaning gently against a wall, with a relaxed yet professional posture, exuding confidence and authority without stiffness. Her stance is slightly angled, adding dynamism and authenticity to the composition.\n\nThe photograph is taken in a professional studio, using a Canon EOS R5 + RF 85mm f/1.2L lens, ensuring a shallow depth of field for a softly blurred background. The setting is minimalist, featuring a neutral gray wall backdrop, creating a sophisticated and timeless aesthetic.\n\nThe lighting mimics a stage or keynote presentation, with a soft spotlight from above, enhancing her features in a dramatic yet elegant way. A subtle rim light is used to separate her from the background, adding depth. The final image has a cinematic, high-end editorial quality, reminiscent of visionary CEO and leadership portraits.",
  "imageFormat": "webp",
  "loraIntensity": 1,
  "outputQuality": 80,
  "enableFastMode": false,
  "inferenceModel": "dev",
  "inferenceSteps": 28,
  "imageMegapixels": "1",
  "numberOfOutputs": 1,
  "promptIntensity": 0.8,
  "imageAspectRatio": "1:1",
  "guidanceIntensity": 3,
  "additionalLoraIntensity": 1
}

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

Brunadepaula's inpainting action is a powerful tool for developers and creatives alike, offering a streamlined way to generate stunning images tailored to specific needs. With the ability to customize numerous parameters, you can create high-quality visuals that enhance your projects, whether for marketing, art, or social media. Next steps could involve exploring additional actions offered by Brunadepaula or integrating this image generation capability into your applications to elevate user engagement and satisfaction.