Create Stunning Images with Sdxl Zeke's Advanced Generation Actions

26 Apr 2025
Create Stunning Images with Sdxl Zeke's Advanced Generation Actions

In the world of digital content creation, the ability to generate high-quality images quickly and efficiently is invaluable. With Sdxl Zeke, developers can leverage advanced Cognitive Actions to generate images based on detailed prompts, masks, and refinement techniques. This service empowers users to create unique visual content that meets their specific needs, whether for marketing, design, or artistic expression. The ability to customize various parameters not only simplifies the image generation process but also enhances the quality of the outputs, making it an essential tool for developers looking to innovate in their projects.

Prerequisites

To get started with Sdxl Zeke's image generation capabilities, you'll need an API key for the Cognitive Actions service and a basic understanding of how to make API calls.

Generate Image with Inpaint and Img2Img

The Generate Image with Inpaint and Img2Img action allows developers to create images using a combination of specified prompts, masks, and various refinement styles. This action supports both img2img and inpaint modes, enabling users to modify existing images or generate new ones from scratch. The flexibility in parameters ensures that developers can achieve high-quality outputs tailored to their requirements.

Input Requirements

The action requires a structured input that includes:

  • Prompt: The text instruction that guides the image generation (e.g., "An astronaut riding a rainbow unicorn").
  • Image: The URI of the input image for img2img or inpaint mode.
  • Mask: A URI for the inpaint mode, where black areas remain unchanged, and white areas are inpainted.
  • Width/Height: Dimensions for the output image, defaulting to 1024 pixels.
  • Guidance Scale: A scaling factor for classifier-free guidance, ensuring the generated image aligns with the prompt.
  • Refine Style: The style of refinement to be used, which can enhance the final output quality.
  • Additional parameters include seed values, output quantity, and options for watermarking.

Example input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "An astronaut riding a rainbow unicorn",
  "loraScale": 0.6,
  "numOutputs": 1,
  "refineStyle": "no_refiner",
  "scheduleType": "K_EULER",
  "guidanceScale": 7.5,
  "highNoiseFrac": 0.8,
  "applyWatermark": true,
  "negativePrompt": "",
  "promptStrength": 0.8,
  "numInferenceSteps": 50
}

Expected Output

The expected output is a high-quality image generated based on the provided specifications. For example, a successful image generation could yield a link to the newly created image, such as:

"https://assets.cognitiveactions.com/invocations/fe1726e3-ee54-491a-b614-4f330b2bcaa8/ca5dcb9b-7e18-4627-87d1-6ad4c8a74723.png"

Use Cases for this Specific Action

  • Creative Projects: Artists and designers can use this action to quickly generate unique images that align with their creative vision.
  • Marketing Materials: Marketers can produce tailored graphics for campaigns, ensuring visuals resonate with target audiences.
  • Game Development: Developers can create assets for games, using inpaint features to modify existing images or generate new environments and characters.
  • Content Creation: Bloggers and content creators can enhance their articles with custom images, enriching visual storytelling.
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 = "e9ba0dbb-9d9c-4abf-b252-0e89e1b0e58d" # Action ID for: Generate Image with Inpaint and Img2Img

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "width": 1024,
  "height": 1024,
  "prompt": "An astronaut riding a rainbow unicorn",
  "loraScale": 0.6,
  "numOutputs": 1,
  "refineStyle": "no_refiner",
  "scheduleType": "K_EULER",
  "guidanceScale": 7.5,
  "highNoiseFrac": 0.8,
  "applyWatermark": true,
  "negativePrompt": "",
  "promptStrength": 0.8,
  "numInferenceSteps": 50
}

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 Zeke's image generation capabilities provide developers with a powerful tool to create stunning visuals tailored to a wide range of applications. By utilizing customizable parameters, users can achieve high-quality outputs that meet specific needs, whether for artistic, marketing, or gaming purposes. To explore these capabilities further, start integrating Sdxl Zeke into your projects today and unlock new possibilities for visual content creation.