Create Stunning Images with the alexizvelz/rosmeri1 Cognitive Actions

22 Apr 2025
Create Stunning Images with the alexizvelz/rosmeri1 Cognitive Actions

In the realm of digital creativity, the ability to generate images programmatically opens up a world of possibilities. The alexizvelz/rosmeri1 specification provides a powerful Cognitive Action for image generation that can create stunning visuals through inpainting and customization. With this action, developers can harness sophisticated models to produce high-quality images tailored to specific prompts, making it an invaluable tool for applications in art, design, and content creation.

Prerequisites

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

  • An API key for the Cognitive Actions platform, which will be used for authentication.
  • Basic knowledge of JSON for constructing input payloads.
  • A suitable development environment set up for making API calls.

For authentication, you will typically pass the API key in the request headers.

Cognitive Actions Overview

Generate Image with Inpainting and Customization

The Generate Image with Inpainting and Customization action allows you to create images using various modes, including inpainting and image-to-image generation. It provides flexibility in aspects such as mask application, aspect ratio customization, and model selection, enabling fine-tuned control over the generated image's quality and style.

  • Category: Image Generation
  • Purpose: Generate images based on a detailed prompt, with options for customization.

Input

The input for this action consists of several parameters, with prompt being the only required field. Here’s a breakdown of the input schema:

{
  "prompt": "string",  // Required: The main input prompt for image generation.
  "mask": "string",    // Optional: Image mask for inpainting mode (URI).
  "seed": "integer",   // Optional: Random seed for reproducibility.
  "image": "string",   // Optional: Input image for inpainting (URI).
  "model": "string",    // Optional: Model type ('dev' or 'schnell').
  "width": "integer",  // Optional: Width of the generated image (256-1440).
  "height": "integer", // Optional: Height of the generated image (256-1440).
  "guidanceScale": "number", // Optional: Scale for guiding the diffusion process.
  "numberOfOutputs": "integer", // Optional: Number of output images to generate.
  "imageAspectRatio": "string", // Optional: Aspect ratio for the generated image.
  "imageOutputFormat": "string", // Optional: Format of the output image.
  "imageOutputQuality": "integer" // Optional: Quality of the output image.
}

Example Input:

{
  "model": "schnell",
  "prompt": "rosmari1 Portrait photography of a young woman sitting outdoors, wearing a wrap top and tight short skirt, a gentle smile and a relaxed pose. The natural background shows a soft focus earthy ground and green foliage, the warm sunlight gently illuminates her face, creating a soft and serene atmosphere, with bokeh effect in the background. Captured with a vintage camera, pastel",
  "guidanceScale": 3.5,
  "mainLoraScale": 1,
  "numberOfOutputs": 1,
  "imageAspectRatio": "1:1",
  "imageOutputFormat": "png",
  "imageOutputQuality": 100,
  "additionalLoraScale": 1,
  "imagePromptStrength": 0.8,
  "numberOfInferenceSteps": 28
}

Output

The output of this action is an array of URLs pointing to the generated images.

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/072fa923-5251-48a5-a223-ae2fe25736d9/3edc354a-c0f8-4c2a-b93c-f6fa7fa4e527.png"
]

Conceptual Usage Example (Python)

Here’s how you can conceptualize calling 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 = "9fbed161-6513-410a-a41f-6863b336dc1a"  # Action ID for Generate Image with Inpainting and Customization

# Construct the input payload based on the action's requirements
payload = {
    "model": "schnell",
    "prompt": "rosmari1 Portrait photography of a young woman sitting outdoors...",
    "guidanceScale": 3.5,
    "mainLoraScale": 1,
    "numberOfOutputs": 1,
    "imageAspectRatio": "1:1",
    "imageOutputFormat": "png",
    "imageOutputQuality": 100,
    "additionalLoraScale": 1,
    "imagePromptStrength": 0.8,
    "numberOfInferenceSteps": 28
}

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, replace the placeholders with your actual API key and the relevant action ID. The payload is structured according to the action's input schema, ensuring that the image generation request is correctly formatted.

Conclusion

The alexizvelz/rosmeri1 Cognitive Action for generating images with inpainting and customization offers developers a robust solution for creating high-quality visuals. By leveraging the flexibility of input options, developers can tailor the image generation process to fit various use cases. Whether you're building a creative application, enhancing a project with vivid imagery, or exploring generative art, this action provides the tools needed to bring your ideas to life. Start experimenting with your prompts and see the magic of image generation unfold!