Create Stunning Custom Images with Plazabandera's AI Actions

26 Apr 2025
Create Stunning Custom Images with Plazabandera's AI Actions

Plazabandera offers a powerful suite of Cognitive Actions designed to simplify the process of generating custom images tailored to your specific needs. Whether you're creating marketing materials, social media posts, or unique artwork, Plazabandera's image generation capabilities allow developers to produce high-quality visuals quickly and efficiently. By leveraging advanced image-to-image and inpainting techniques, users can customize output quality, dimensions, and even model preferences, resulting in stunningly realistic images.

Common use cases for Plazabandera include generating promotional graphics, designing personalized content for events, and enhancing existing images with new elements. The ability to specify a wide range of parameters ensures that your creative vision can be realized with precision, making it an invaluable tool for developers and designers alike.

Prerequisites

To get started with Plazabandera's Cognitive Actions, you'll need an API key and a basic understanding of making API calls to utilize the various features effectively.

Generate Custom Image

The "Generate Custom Image" action allows you to create custom images using image-to-image or inpainting techniques. This action is particularly useful for developers looking to produce unique visuals based on specific prompts or modify existing images with new elements.

Input Requirements:
To utilize this action, you'll need to provide a JSON object that includes the following key fields:

  • prompt (required): A textual description that guides the image generation process.
  • image (optional): A URI of an input image for inpainting or image-to-image generation.
  • mask (optional): A URI for an image mask used in inpainting mode.
  • Additional parameters like width, height, imageFormat, and various quality settings allow for further customization.

Expected Output:
The output will be a URI linking to the generated image based on your specifications. For example, a successful request might return an output like:

  • https://assets.cognitiveactions.com/invocations/1fd91c2b-c54f-45e7-9b53-6a7b24b391b2/79551afd-8a7b-47f7-affc-2ad186e32029.webp

Use Cases for this specific action:

  • Marketing Campaigns: Generate eye-catching visuals for social media posts, advertisements, or newsletters based on detailed prompts.
  • Event Promotions: Create promotional graphics for events, ensuring that the imagery aligns with the theme and messaging.
  • Artistic Projects: Develop unique artworks by blending existing images with new creative elements, allowing artists to experiment with different styles and concepts.

```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 = "9922244c-da74-4bc8-938f-2ef59feff7be" # Action ID for: Generate Custom Image

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "model": "dev",
  "prompt": "TOKPlaza-Bandera announcement for a protest march organized by the “Antigua Orden Dominicana.” The text is in Spanish and features a yellow circle with an illustration of a monument. The message calls for immigration control and states that if no action is taken, a permanent protest will begin on Saturday, October 5 at 4:00 p.m. in the Plaza de la Bandera. The website “antiguaorden.com” is also mentioned for more information. We have a date with the homeland, this Saturday, October 5 at 4:00 p.m. 🇩🇴",
  "imageFormat": "webp",
  "outputCount": 1,
  "imageQuality": 90,
  "promptInfluence": 0.8,
  "imageAspectRatio": "1:1",
  "diffusionGuidance": 3.5,
  "mainLoraIntensity": 1,
  "inferenceStepCount": 28,
  "externalLoraIntensity": 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
Plazabandera's Cognitive Actions, particularly the ability to generate custom images, provide developers with powerful tools to create high-quality visuals tailored to their needs. The flexibility in configuration options and the ease of use open up numerous possibilities for application in marketing, event promotion, and artistic endeavors. To explore these capabilities further, start integrating Plazabandera into your projects and unlock the potential of AI-driven image generation.