Enhance Your Images with the vetkastar/image_tune Cognitive Actions

25 Apr 2025
Enhance Your Images with the vetkastar/image_tune Cognitive Actions

In the world of image processing, making enhancements and applying transformations can be a game changer for developers. The vetkastar/image_tune API provides a powerful set of Cognitive Actions that allow you to enhance and manipulate images effortlessly. With just a few parameters, you can apply artistic effects, adjust attributes, and create stunning visuals for your applications.

Prerequisites

Before you dive into using the Cognitive Actions, ensure you have the following:

  • An API key for the Cognitive Actions platform, which you will use to authenticate your requests.
  • Familiarity with JSON and basic HTTP requests, as you'll be sending and receiving JSON payloads.

To authenticate your requests, you will typically include the API key in the request headers. Here’s a conceptual outline of what that might look like:

Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Cognitive Actions Overview

Apply Image Effects and Transformations

The Apply Image Effects and Transformations action allows you to enhance and manipulate images by applying various effects such as blur, noise, sepia, glitch, and more. You can fine-tune attributes like sharpness, brightness, saturation, and temperature, providing you with complete control over the visual outcome.

Input

The input schema for this action is a JSON object with the following fields:

  • imagePath (required): URI of the input image.
  • blur (optional): A number from 0 (no blur) to 1 (maximum blur).
  • noise (optional): A number from 0 (no noise) to 1 (maximum noise).
  • sepia (optional): Boolean to apply a sepia tone effect.
  • glitch (optional): Boolean to apply a glitch effect.
  • contrast (optional): A number from 0 (lowest) to 2 (highest).
  • vignette (optional): A number from 0 (no vignette) to 1 (maximum vignette).
  • flipImage (optional): Boolean to flip the image horizontally.
  • sharpness (optional): A number from 0 (no sharpening) to 1 (maximum sharpening).
  • brightness (optional): A number from 0 (darkest) to 2 (brightest).
  • saturation (optional): A number from 0 (grayscale) to 2 (high saturation).
  • asciiEffect (optional): Integer defining the intensity of the ASCII art effect.
  • temperature (optional): A number from 0 (cooler) to 2 (warmer).
  • autoContrast (optional): Boolean to automatically adjust the image contrast.
  • autoSharpness (optional): Boolean to automatically adjust the image sharpness.
  • blackAndWhite (optional): Boolean to convert the image to black and white.
  • rotateDegrees (optional): A number for rotation from -180 to 180 degrees.
  • exposureOffset (optional): A number from 0 to 1 for exposure adjustment.
  • autoWhiteBalance (optional): Boolean for automatic white balance adjustment.
  • tiltShiftPosition (optional): Specifies the position for the tilt-shift effect.
  • autoColorCorrection (optional): Boolean for automatic color correction.
  • chromaticAberration (optional): A number from 0 (no effect) to 1 (maximum effect).

Example Input:

{
  "blur": 0,
  "noise": 0,
  "glitch": false,
  "contrast": 1,
  "vignette": 0,
  "flipImage": false,
  "imagePath": "https://replicate.delivery/pbxt/KbBnSqB6n35nzSK3wkg6TEduH6czJMgd0aNVdTArKNwkIzWw/4.png",
  "sharpness": 0,
  "vhsEffect": false,
  "brightness": 1,
  "saturation": 1,
  "asciiEffect": 0,
  "temperature": 1,
  "autoContrast": true,
  "autoSharpness": false,
  "rotateDegrees": 0,
  "exposureOffset": 0,
  "autoWhiteBalance": false,
  "tiltShiftPosition": "None",
  "autoColorCorrection": false,
  "chromaticAberration": 0
}

Output

Upon successful execution, this action typically returns a URL pointing to the enhanced image.

Example Output:

https://assets.cognitiveactions.com/invocations/b7b4182e-922b-41a1-a4dc-c7a1946fbd2c/5503194d-9cb2-4d78-bf91-26c50b14af64.png

Conceptual Usage Example (Python)

Here’s how you might call this action using Python:

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 = "b650d5e2-2e9c-4705-a971-bf247fc2caa1"  # Action ID for Apply Image Effects and Transformations

# Construct the input payload based on the action's requirements
payload = {
  "blur": 0,
  "noise": 0,
  "glitch": False,
  "contrast": 1,
  "vignette": 0,
  "flipImage": False,
  "imagePath": "https://replicate.delivery/pbxt/KbBnSqB6n35nzSK3wkg6TEduH6czJMgd0aNVdTArKNwkIzWw/4.png",
  "sharpness": 0,
  "brightness": 1,
  "saturation": 1,
  "asciiEffect": 0,
  "temperature": 1,
  "autoContrast": True,
  "autoSharpness": False,
  "rotateDegrees": 0,
  "exposureOffset": 0,
  "autoWhiteBalance": False,
  "tiltShiftPosition": "None",
  "autoColorCorrection": False,
  "chromaticAberration": 0
}

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 snippet, replace "YOUR_COGNITIVE_ACTIONS_API_KEY" with your actual API key. The action ID for "Apply Image Effects and Transformations" is defined, and the input payload is structured according to the action's requirements.

Conclusion

The vetkastar/image_tune Cognitive Actions provide developers with powerful tools to enhance and manipulate images seamlessly. From applying artistic effects to fine-tuning image attributes, these actions open up a world of possibilities for creating stunning visuals in your applications. Start integrating these actions today and elevate your image processing capabilities!