Generate Stunning Underwater Images with the fofr/sdxl-deep-down Cognitive Actions

25 Apr 2025
Generate Stunning Underwater Images with the fofr/sdxl-deep-down Cognitive Actions

In the world of digital content creation, the ability to generate unique and visually captivating images is invaluable. The fofr/sdxl-deep-down API offers a powerful Cognitive Action called Generate Underwater Imagery, specifically designed to create stunning underwater-themed images. By leveraging a fine-tuned SDXL model on Dalle3's underwater imagery, developers can easily customize image dimensions, prompts, and refinement styles to produce unique visual content.

In this article, we’ll explore how to effectively integrate this Cognitive Action into your applications, enabling you to enhance your projects with breathtaking underwater visuals.

Prerequisites

Before getting started with the Generate Underwater Imagery action, ensure you have the following:

  • An API key for the Cognitive Actions platform to authenticate your requests.
  • Basic knowledge of JSON structure, as the input and output are formatted in JSON.
  • Familiarity with making HTTP requests in your preferred programming language.

Authentication typically involves passing your API key in the headers of your requests.

Cognitive Actions Overview

Generate Underwater Imagery

Purpose:
The Generate Underwater Imagery action allows developers to create underwater-themed images using customizable parameters.

Category:
Image Generation

Input

The input for this action is structured as a JSON object. Below are the details of the required and optional fields:

FieldTypeDescriptionDefault Value
maskstringInput mask for inpaint mode. Black areas will be preserved, white areas will be inpainted.N/A
seedintegerSpecifies the random seed for generating images. Leave blank for a randomized seed.N/A
widthintegerSpecifies the width of the output image in pixels.1024
heightintegerSpecifies the height of the output image in pixels.1024
promptstringText prompt that guides the image generation."An astronaut riding a rainbow unicorn."
refinestringSelects the refinement style for image generation. Options: no_refiner, expert_ensemble_refiner, base_image_refiner."no_refiner"
loraScalenumberAdjustable scale for LoRA models. Must be between 0 and 1.0.6
schedulerstringDetermines the scheduling algorithm for the image generation process."K_EULER"
inputImagestringURL of the input image, required for img2img or inpaint modes.N/A
loraWeightsstringSpecifies the LoRA weights to use. Leave blank to use the default weights.N/A
refineStepsintegerSpecifies the number of refinement steps for base_image_refiner. Defaults to the value of inferenceSteps.N/A
guidanceScalenumberDetermines the scale of classifier-free guidance. Must be between 1 and 50.7.5
applyWatermarkbooleanDetermines whether a watermark will be applied to generated images.true
inferenceStepsintegerDefines the number of denoising steps in the generation process. Must be between 1 and 500.50
negativePromptstringText prompt to guide which elements to avoid during image generation.""
promptStrengthnumberAdjusts the influence of the prompt in img2img or inpaint modes.0.8
numberOfOutputsintegerSpecifies the number of images to generate. Must be between 1 and 4.1
highNoiseFractionnumberSets the fraction of noise to apply when using the expert_ensemble_refiner.0.8
disableSafetyCheckerbooleanToggle to disable the safety checker on generated images when using the API.false

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "A close-up portrait photo in the style of TOK",
  "refine": "no_refiner",
  "loraScale": 0.6,
  "scheduler": "K_EULER",
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "inferenceSteps": 50,
  "negativePrompt": "",
  "promptStrength": 0.8,
  "numberOfOutputs": 1,
  "highNoiseFraction": 0.8
}

Output

The output of this action will typically be a JSON array containing the URLs of the generated images.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/593946e2-1233-4ea6-be7f-25c00f26e936/543da87a-86ce-40b3-9cdd-8dd11953805b.png"
]

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet demonstrating how to call the Generate Underwater Imagery action using a hypothetical Cognitive Actions execution endpoint:

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 = "063d1dd5-a648-48a9-9d95-ded3de700791"  # Action ID for Generate Underwater Imagery

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "A close-up portrait photo in the style of TOK",
    "refine": "no_refiner",
    "loraScale": 0.6,
    "scheduler": "K_EULER",
    "guidanceScale": 7.5,
    "applyWatermark": True,
    "inferenceSteps": 50,
    "negativePrompt": "",
    "promptStrength": 0.8,
    "numberOfOutputs": 1,
    "highNoiseFraction": 0.8
}

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 example, make sure to replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key. The payload variable is structured according to the input requirements we discussed earlier.

Conclusion

The Generate Underwater Imagery action from the fofr/sdxl-deep-down API provides developers with a robust tool for creating stunning underwater-themed images. With customizable input parameters, you can generate unique visual content tailored to your specific needs. Whether you're building an application that requires rich media or exploring creative projects, integrating this Cognitive Action can elevate your work to new depths.

Ready to dive in? Start experimenting with the action today and unlock a world of creative possibilities!