Create Stunning Images with Tinybliss Cognitive Actions

27 Apr 2025
Create Stunning Images with Tinybliss Cognitive Actions

In the world of digital creativity, generating high-quality images quickly and effectively is essential for developers, designers, and marketers alike. Tinybliss offers a powerful set of Cognitive Actions designed to revolutionize image generation through customizable parameters and advanced techniques like inpainting. This service not only speeds up the creation process but also simplifies the workflow, allowing developers to focus on their creative vision rather than the intricacies of image manipulation.

With Tinybliss, you can generate detailed images tailored to your specifications, whether you need an image for a marketing campaign, a visual for a blog post, or assets for a game. The flexibility of customizable parameters means you can adapt to various scenarios, including the need for specific dimensions, aspect ratios, or styles, making it an invaluable tool for any developer looking to enhance their projects.

Prerequisites

To get started with Tinybliss, you'll need an API key for Cognitive Actions and a basic understanding of how to make API calls.

Generate Image with Inpainting and Customization

The "Generate Image with Inpainting and Customization" action allows you to create detailed images using a variety of customizable parameters. This action is particularly useful for generating images that require specific alterations or enhancements, enabling you to address unique visual requirements with ease.

Purpose

This action solves the problem of needing high-quality, customized images quickly. By allowing developers to specify various parameters such as the model type, image dimensions, and output format, it empowers users to create images that meet their exact needs.

Input Requirements

The input schema requires a prompt, which is the core element guiding the image generation. Other optional parameters include:

  • Mask: An image mask for inpainting mode.
  • Seed: A random seed for reproducibility.
  • Image: An input image for image-to-image or inpainting mode.
  • Model: Choose between 'dev' or 'schnell'.
  • Width and Height: Dimensions for the generated image.
  • Aspect Ratio: Define the aspect ratio for the image.
  • Output Count: Number of images to generate (1-4).
  • Output Format: Format of the generated images (webp, jpg, png).
  • And several other customization options to fine-tune the output.

Expected Output

The output will be a generated image based on the specified parameters, with a URL link provided for easy access.

Use Cases for this Specific Action

  1. Marketing Materials: Generate tailored visuals for promotional content that align with brand guidelines.
  2. Content Creation: Create unique images for blog posts, social media, or website assets that resonate with your audience.
  3. Game Development: Produce concept art or assets that can be directly integrated into gaming environments.
  4. Personal Projects: Craft personalized images for gifts, events, or digital art showcases.

By leveraging this action, developers can streamline their creative process and produce high-quality images in a fraction of the time.

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 = "06b206ef-5207-4a0b-b90c-dfb79dd6356d" # Action ID for: Generate Image with Inpainting and Customization

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "model": "dev",
  "prompt": "Raha is wearing a work attire and has brown hair. she is working on her computer in home office",
  "fastMode": false,
  "megapixels": "1",
  "aspectRatio": "3:4",
  "outputCount": 1,
  "outputFormat": "webp",
  "guidanceScale": 3,
  "outputQuality": 80,
  "promptStrength": 0.9,
  "inferenceStepCount": 28,
  "primaryLoraIntensity": 1,
  "additionalLoraIntensity": 1
}

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

Tinybliss provides developers with a robust tool for generating stunning images tailored to their specific needs. With customizable parameters and advanced features like inpainting, the possibilities for creativity are endless. Whether you're working on a commercial project or a personal endeavor, integrating Tinybliss into your workflow can significantly enhance your productivity and output quality. Explore the capabilities of Tinybliss today and elevate your image generation process to new heights!