Enhance Your Images with Clarity Upscaler

26 Apr 2025
Enhance Your Images with Clarity Upscaler

The Clarity Upscaler is a powerful tool designed to upscale and enhance images, providing developers with an efficient way to improve image resolution and quality. Leveraging advanced algorithms, this service offers a free alternative to existing solutions like Magnific, making it accessible and user-friendly. With support for HDR processing and various creative adjustments, the Clarity Upscaler can transform your images into stunning visuals, perfect for a wide range of applications.

Imagine a scenario where you need to enhance low-resolution images for a marketing campaign or a website. The Clarity Upscaler can help you achieve high-quality results quickly, saving you time and resources while ensuring that your visuals stand out. Whether you're a graphic designer, a game developer needing high-quality textures, or a content creator looking to improve your imagery, this tool is designed to meet your needs.

Prerequisites

To get started with the Clarity Upscaler, you'll need a Cognitive Actions API key and a basic understanding of making API calls.

Enhance Image Resolution with Clarity Upscaler

The primary action of the Clarity Upscaler is to enhance image resolution, allowing you to upscale images while improving their overall quality. This action addresses the common challenge of working with low-resolution images that lack detail and clarity.

Input Requirements

To utilize this action, you need to provide the following inputs:

  • image: A URI pointing to the input image you wish to enhance.
  • prompt: A descriptive text prompt that guides the generation process, defaulting to high-quality settings.
  • scaleFactor: The factor by which you want to upscale the image, with a default of 2.
  • dynamic: A value controlling the HDR effect, typically between 3 and 9.
  • sharpen: An optional value to adjust the sharpening effect post-upscaling.
  • Additional parameters such as mask, seed, and scheduler can also be included to customize the output further.

Expected Output

Once the image is processed, you will receive a URI to the enhanced image, which will reflect the improvements made based on your input parameters.

Use Cases for this Specific Action

  • Content Creation: Perfect for bloggers and marketers who need high-quality images for their online content to attract viewers.
  • Game Development: Game developers can use this action to upscale textures, ensuring that low-resolution assets look great on modern displays.
  • E-commerce: Retailers can enhance product images to provide potential buyers with a clearer view of their offerings, boosting sales.
  • Art Restoration: Artists and historians can restore and enhance old photographs or artworks, bringing new life to valuable pieces.
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 = "95a2a24b-dd69-4d79-87e8-7c7639d15d85" # Action ID for: Enhance Image Resolution with Clarity Upscaler

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "seed": 1337,
  "image": "https://replicate.delivery/pbxt/KiDB5iqtTcxiTI17WASotG1Ei0TNJCztdU6J02pnMYAd8B1X/13_before-4.png",
  "prompt": "masterpiece, best quality, highres, <lora:more_details:0.5> <lora:SDXLrender_v2.0:1>",
  "dynamic": 6,
  "loraLinks": "",
  "scheduler": "DPM++ 3M SDE Karras",
  "tileWidth": 112,
  "creativity": 0.35,
  "tileHeight": 144,
  "downscaling": false,
  "resemblance": 0.6,
  "scaleFactor": 2,
  "inferenceSteps": 18,
  "negativePrompt": "(worst quality, low quality, normal quality:2) JuggernautNegative-neg",
  "stableDiffusionModel": "juggernaut_reborn.safetensors [338b85bc4f]",
  "downscalingResolution": 768,
  "customStableDiffusionModel": ""
}

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 Clarity Upscaler offers an invaluable resource for developers looking to enhance image quality and resolution quickly and efficiently. By integrating this action into your workflows, you can significantly improve the visual appeal of your projects, whether for personal use or commercial applications. Explore the Clarity Upscaler today and elevate your image processing capabilities to new heights!