Transform Your Photos with the SkyTells Photo Stylizer Cognitive Action

22 Apr 2025
Transform Your Photos with the SkyTells Photo Stylizer Cognitive Action

In the ever-evolving landscape of digital creativity, the SkyTells Photo Stylizer offers developers powerful tools to enhance images through stylization. This API allows you to transform a given photo using predefined styles, enabling you to generate visually appealing images that can range from cinematic to artistic effects. With customizable aesthetic options, developers can leverage these pre-built actions to elevate their applications’ visual content effortlessly.

Prerequisites

Before diving into the integration of the Cognitive Actions, ensure you have the following:

  • An API key for the SkyTells Photo Stylizer.
  • Basic knowledge of making HTTP requests and handling JSON data.

Authentication typically involves passing your API key in the request headers, allowing you to securely access the Cognitive Actions.

Cognitive Actions Overview

Apply Photo Stylization

The Apply Photo Stylization action allows you to transform a photo by applying various predefined styles, which can be customized according to your project needs. This action is categorized under image processing and is ideal for any application requiring enhanced visual content.

Input

The input for this action requires a primaryInputImage and allows for several optional fields to fine-tune the output:

  • primaryInputImage (required): string - URI of the primary input image.
    Example: "https://replicate.delivery/pbxt/L36r8bN46NHYD355EoyKIwszxm0n4arV0M0cFUkeEFLZILxQ/replicate-prediction-bmyfq8y0nnrgj0cf2sp88h15jc.png"
  • seed: integer - Random seed for generating outputs. Leave blank for a random seed.
    Example: 12345
  • prompt: string - A text prompt to guide the image generation.
    Example: "A man img in front of a whimsical castle, 3d CGI, art by Pixar, half-body, screenshot from animation"
  • numberOfSteps: integer - Specifies the number of sampling steps (default is 20).
    Example: 50
  • styleTemplate: string - Select a template to apply a specific style.
    Example: "(No style)"
  • negativePrompt: string - Elements to avoid during image generation.
    Example: "nsfw, lowres, bad anatomy, ..."
  • numberOfOutputs: integer - Specifies how many images to generate (1 to 4).
    Example: 2
  • guidanceIntensity: number - Strength of the guidance signal (1 to 10).
    Example: 5
  • styleStrengthPercentage: number - Strength of the applied style as a percentage (15% to 50%).
    Example: 35

Additional optional fields include multiple input images, safety checker toggles, and more.

Example Input

{
  "prompt": "A man img in front of a whimsical castle, 3d CGI, art by Pixar, half-body, screenshot from animation",
  "numberOfSteps": 50,
  "styleTemplate": "(No style)",
  "negativePrompt": "nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry",
  "numberOfOutputs": 2,
  "guidanceIntensity": 5,
  "primaryInputImage": "https://replicate.delivery/pbxt/L36r8bN46NHYD355EoyKIwszxm0n4arV0M0cFUkeEFLZILxQ/replicate-prediction-bmyfq8y0nnrgj0cf2sp88h15jc.png",
  "styleStrengthPercentage": 35
}

Output

Upon executing the Apply Photo Stylization action, you can expect an array of output URLs which link to the stylized images generated:

[
  "https://assets.cognitiveactions.com/invocations/eadcf3c6-1d80-47dc-8f69-900aa4130053/8bcb25e6-ebb4-47be-81c2-c8f610a2563e.png",
  "https://assets.cognitiveactions.com/invocations/eadcf3c6-1d80-47dc-8f69-900aa4130053/44915a4c-bc20-4de9-bc2f-c9a40fe69e1b.png"
]

Conceptual Usage Example (Python)

Here’s how you might call the Apply Photo Stylization action using Python. This example illustrates how to structure your input JSON payload correctly.

import requests
import json

# Replace with your Cognitive Actions API key and endpoint
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"  # Hypothetical endpoint

action_id = "9697f095-271f-4303-b332-c761b78b7694"  # Action ID for Apply Photo Stylization

# Construct the input payload based on the action's requirements
payload = {
    "prompt": "A man img in front of a whimsical castle, 3d CGI, art by Pixar, half-body, screenshot from animation",
    "numberOfSteps": 50,
    "styleTemplate": "(No style)",
    "negativePrompt": "nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry",
    "numberOfOutputs": 2,
    "guidanceIntensity": 5,
    "primaryInputImage": "https://replicate.delivery/pbxt/L36r8bN46NHYD355EoyKIwszxm0n4arV0M0cFUkeEFLZILxQ/replicate-prediction-bmyfq8y0nnrgj0cf2sp88h15jc.png",
    "styleStrengthPercentage": 35
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json"
}

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json={"action_id": action_id, "inputs": payload}  # Hypothetical structure
    )
    response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully:")
    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: {e.response.text}")

In this code snippet, replace the COGNITIVE_ACTIONS_API_KEY and COGNITIVE_ACTIONS_EXECUTE_URL with your actual API key and endpoint. The action_id corresponds to the specific action you want to execute. The input payload is structured to match the requirements of the Apply Photo Stylization action.

Conclusion

The SkyTells Photo Stylizer presents an exciting opportunity for developers to enhance their applications with powerful photo enhancement capabilities. By leveraging the Apply Photo Stylization action, you can effortlessly transform images into stunning works of art, catering to various aesthetic preferences. Start integrating today and explore how these actions can revolutionize your visual content!