Create Stunning 360 Panoramic Images Effortlessly

27 Apr 2025
Create Stunning 360 Panoramic Images Effortlessly

The "360 Pano" service offers developers an innovative way to generate breathtaking panoramic images through its Cognitive Actions. By leveraging advanced image generation techniques, this service simplifies the creation of immersive visuals, making it easier than ever to bring creative ideas to life. Whether you're enhancing a virtual reality experience, enriching a digital gallery, or simply looking to create stunning backgrounds, "360 Pano" provides the tools to elevate your projects.

Prerequisites

To start using the "360 Pano" service, you'll need a Cognitive Actions API key and a basic understanding of API calls to make the most out of the available actions.

Generate Panoramic Image

The "Generate Panoramic Image" action allows you to create a panoramic image based on either a text prompt or an existing image. This feature is particularly beneficial for developers looking to automate the creation of engaging visuals tailored to specific themes or settings. Users can also upscale images and adjust the guidance scale for more customized outputs, ensuring that the final product meets their unique requirements.

Input Requirements

To utilize this action, you need to provide a structured input that includes:

  • Seed: An optional integer specifying the random seed for generating deterministic outputs (defaults to a random seed if omitted).
  • Image: A URI of the input image to be used in the request.
  • Prompt: A text prompt guiding the image generation, with a default of "A living room".
  • Upscale: A boolean indicating if the generated image should be upscaled (defaults to false).
  • Guidance Scale: A number that adjusts the intensity of classifier-free guidance, with a default of 7.5.
  • Num Inference Steps: An integer specifying how many denoising steps to perform (defaults to 20).

Example Input

{
  "seed": 0,
  "prompt": "A kids room",
  "upscale": true,
  "guidanceScale": 7.5,
  "numInferenceSteps": 20
}

Expected Output

Upon successful execution, the output will be a URL linking to the generated panoramic image, allowing for easy integration into your applications or platforms.

Example Output

https://assets.cognitiveactions.com/invocations/2ecdb8fe-40ba-44ca-a435-488591ed6b9d/50e0473d-bb4b-4fa6-b81a-8862ca20b50a.png

Use Cases for this Action

Developers can leverage the "Generate Panoramic Image" action in various scenarios, including:

  • Virtual Tours: Create immersive panoramic images for real estate listings, museums, or travel websites, enhancing user engagement and experience.
  • Gaming: Design unique environments or backgrounds for games, enriching the visual storytelling and player immersion.
  • Marketing: Generate captivating visuals for promotional materials or social media campaigns, helping brands stand out in a crowded marketplace.
  • Art Projects: Explore creative possibilities by generating unique art pieces based on descriptive prompts, allowing for endless artistic expression.

```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 = "e1fe6d0f-460b-46e9-87a1-811b2e6d39f5" # Action ID for: Generate Panoramic Image

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "seed": 0,
  "prompt": "A kids room",
  "upscale": true,
  "guidanceScale": 7.5,
  "numInferenceSteps": 20
}

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
The "360 Pano" service empowers developers to create stunning panoramic images with ease, enhancing their projects and providing users with immersive experiences. With customizable features like upscaling and adjustable guidance scales, this action is a powerful tool for a wide range of applications. Start integrating this service today and unlock new creative possibilities in your projects!