Create Stunning Custom Images with Linnea 4

27 Apr 2025
Create Stunning Custom Images with Linnea 4

In the realm of digital art and design, having the ability to generate custom images quickly and efficiently can be a game changer. Linnea 4 offers an advanced set of Cognitive Actions for image generation, allowing developers to create inpainted images with highly customizable properties. This service leverages sophisticated diffusion models to produce high-quality visuals tailored to specific needs. Whether you're enhancing existing images or creating entirely new compositions, Linnea 4 simplifies the process, enabling faster workflows and creative possibilities.

Use Cases

Linnea 4's image generation capabilities are perfect for a variety of applications, including:

  • Character Design: Create unique character illustrations for games or animations by easily modifying poses and attributes.
  • Marketing Material: Generate eye-catching visuals for promotional content, social media posts, or advertisements.
  • Concept Art: Quickly visualize ideas and concepts, making it easier to communicate with team members or stakeholders.
  • Personal Projects: For artists and hobbyists, Linnea 4 provides a powerful tool to explore creative ideas without extensive manual effort.

To get started with Linnea 4, you will need a Cognitive Actions API key and a basic understanding of how to make API calls.

Generate Custom Inpainted Images

The "Generate Custom Inpainted Images" action allows developers to create inpainted images by specifying various parameters to control the output. This action is particularly useful for modifying existing images or generating new ones based on textual prompts.

Purpose

This action solves the challenge of creating high-quality, customized images through a simple input mechanism, enabling developers to focus on their creative vision rather than the technical details of image processing.

Input Requirements

To utilize this action, you need to provide several inputs:

  • Prompt: A textual description guiding the image generation.
  • Mask: A URI pointing to an image mask for inpainting.
  • Image: URI of the input image for modification.
  • Dimensions: Width and height settings, if custom aspect ratios are used.
  • Additional Parameters: Options like guidance scale, output quality, and the number of outputs.

For example, a typical input might look like this:

{
  "prompt": "linnea character turn around with three different poses, kawaii, cute, blue hair, young girl",
  "extraLora": "aramintak/linnea-flux-beta/versions/7d86be5fa7e383f1b1e867ebd01d650159b8881cc0e0eb4e67b82161eba9fd08",
  "loraScale": 0.4,
  "numOutputs": 4,
  "outputFormat": "webp",
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "extraLoraScale": 0.9,
  "inferenceModel": "dev",
  "promptStrength": 0.8,
  "imageAspectRatio": "16:9",
  "numInferenceSteps": 28
}

Expected Output

The output will be a series of image URLs, each representing a generated inpainted image based on the provided parameters. For instance:

  • https://assets.cognitiveactions.com/invocations/945b2879-7018-4e86-988a-ed242fa3f5be/7b66b012-547a-490d-b18b-9e56a5d5b463.webp
  • https://assets.cognitiveactions.com/invocations/945b2879-7018-4e86-988a-ed242fa3f5be/f013ad3f-eef3-49ed-a8ec-953351010ec9.webp

Use Cases for this Action

  • Artistic Projects: Ideal for artists looking to bring their concepts to life with minimal effort.
  • Game Development: Quickly generate diverse character assets or backgrounds based on specific design prompts.
  • Advertising: Create tailored visuals for campaigns that resonate with target audiences by adjusting prompts and styles dynamically.

```python
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 = "76f1aa84-1561-4b72-87b8-d2a8c4fb0827" # Action ID for: Generate Custom Inpainted Images

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "prompt": "linnea character turn around with three different poses, kawaii, cute, blue hair, young girl",
  "extraLora": "aramintak/linnea-flux-beta/versions/7d86be5fa7e383f1b1e867ebd01d650159b8881cc0e0eb4e67b82161eba9fd08",
  "loraScale": 0.4,
  "numOutputs": 4,
  "outputFormat": "webp",
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "extraLoraScale": 0.9,
  "inferenceModel": "dev",
  "promptStrength": 0.8,
  "imageAspectRatio": "16:9",
  "numInferenceSteps": 28
}

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
Linnea 4's image generation capabilities offer immense value for developers looking to enhance their creative projects. With customizable options and the ability to generate high-quality visuals quickly, it's an essential tool for anyone in the digital art space. As you explore these actions, consider the myriad of applications they can serve in your projects, from professional designs to personal artistic endeavors. Dive into Linnea 4 and unlock new creative potentials today!