Create Stunning Cinematic Images with Sdxl Cinematic 2

The Sdxl Cinematic 2 service offers developers an advanced solution for generating high-quality cinematic images. Leveraging sophisticated inpainting and image refinement techniques, this API allows for the creation of visually stunning outputs that can be customized to meet specific needs. With features such as adjustable prompt strength, guidance scale, and noise fraction, developers can create unique images tailored to various artistic styles and requirements.
Use Cases
Imagine the possibilities: graphic designers can enhance their projects with eye-catching visuals, filmmakers can generate concept art for their next big production, and marketers can create engaging content that captivates audiences. By integrating Sdxl Cinematic 2 into your applications, you can automate image generation, streamline workflows, and significantly reduce the time and effort spent on visual content creation.
Prerequisites
To get started, you'll need a Cognitive Actions API key and a basic understanding of making API calls.
Generate Cinematic Image
The Generate Cinematic Image action is designed to produce high-quality cinematic images using the SDXL Cinematic 2 model. This operation not only generates images but also provides advanced options to refine and customize the output based on user-defined parameters.
Input Requirements: The action accepts a variety of input parameters:
- Mask: URI of the input mask for inpainting. Areas in black remain unchanged, while white areas are subject to inpainting.
- Seed: An integer seed for randomization (optional).
- Image: URI of the input image for img2img or inpaint mode.
- Width: Width of the output image in pixels (default is 1024).
- Height: Height of the output image in pixels (default is 512).
- Prompt: Text prompt to guide image generation (default is "An astronaut riding a rainbow unicorn").
- Lora Scale: Scale factor for LoRA models (default is 0.6).
- Output Image Count: Number of images to generate (between 1 and 4; default is 1).
- Refinement Style: Method of refinement to apply (options include 'no_refiner', 'expert_ensemble_refiner', and 'base_image_refiner').
- Prompt Strength: Strength of the prompt influence (default is 0.8).
- Guidance Scale: Coefficient for classifier-free guidance (default is 7.5).
- Apply Watermark: Indicates whether a watermark will be applied (default is true).
- Negative Prompt: Text prompt to suppress undesirable elements in the image.
- High Noise Fraction: Fraction of noise for use in 'expert_ensemble_refiner' (default is 0.8).
- Inference Steps: Total number of denoising steps during image generation (default is 50).
- Scheduling Algorithm: Algorithm to determine the steps scheduling (default is 'K_EULER').
- Disable Safety Checker: Toggle for disabling the safety checker on generated images.
Expected Output: The output will be a URI pointing to the generated cinematic image. For example:
https://assets.cognitiveactions.com/invocations/1edf3e14-14d2-47aa-89bd-b271d1876f00/3b0fe9ca-48a9-47c9-bedd-cd7ff0c3073e.png
Use Cases for this action: This action is perfect for a variety of applications, including:
- Concept Art Creation: Artists and designers can quickly generate detailed concept art for films, games, or other creative projects.
- Marketing Materials: Businesses can create unique visuals for advertising campaigns, social media posts, or website content.
- Rapid Prototyping: Developers can use this tool to quickly create images for user testing or presentations without needing extensive design skills.
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 = "11ddbdef-3ca3-4519-8f49-3ae188e48d84" # Action ID for: Generate Cinematic Image
# 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": 512,
"prompt": "old woman in a cafe, tense, dim light, in the style of TOK, crisp, sharp",
"loraScale": 0.8,
"outputCount": 1,
"refineStyle": "expert_ensemble_refiner",
"promptImpact": 0.8,
"guidanceScale": 7.5,
"applyWatermark": true,
"opposingPrompt": "extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured",
"highNoiseFraction": 0.8,
"numInferenceSteps": 70,
"schedulingAlgorithm": "K_EULER"
}
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 Cinematic 2 provides a powerful tool for developers looking to enhance their applications with high-quality image generation capabilities. By utilizing the Generate Cinematic Image action, you can create stunning visuals that elevate your projects and engage your audience. Start integrating this API into your workflows today to streamline your creative processes and unlock new possibilities in image generation.