Create Stunning Scribbled Art with the brunnolou/scribble-art-portrait Actions

23 Apr 2025
Create Stunning Scribbled Art with the brunnolou/scribble-art-portrait Actions

In the world of generative art, the brunnolou/scribble-art-portrait API offers an exciting way to transform images into unique scribbled art-style drawings. By leveraging pre-built Cognitive Actions, developers can effortlessly integrate advanced image generation capabilities into their applications. This article will guide you through the available action, its functionalities, and how to implement it in your projects.

Prerequisites

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

  • An API key for the Cognitive Actions platform.
  • Familiarity with making HTTP requests in your programming language of choice.

Authentication typically involves passing your API key in the request headers, allowing you to securely access the Cognitive Actions.

Cognitive Actions Overview

Generate Scribbled Art Drawing

Description: This action creates unique, scribbled art-style drawings using an input image. Developers can customize options for prompt strength, guidance scale, refinement style, and more. It supports both img2img and inpainting modes for detailed and artistically styled outputs.

Category: Image Generation

Input

The input schema for this action consists of several properties, allowing for detailed customization. Here’s a breakdown of the required and optional fields, along with an example:

  • image (string, required): URI pointing to the input image for img2img or inpaint mode.
  • width (integer, optional): Width of the output image in pixels (default: 1024).
  • height (integer, optional): Height of the output image in pixels (default: 1024).
  • prompt (string, optional): Textual prompt for generating images (default: "An astronaut riding a rainbow unicorn").
  • guidanceScale (number, optional): Scale for classifier-free guidance (default: 7.5).
  • numberOfOutputs (integer, optional): Specifies how many images to output (default: 1).
  • promptStrength (number, optional): Strength of the prompt when using img2img or inpaint modes (default: 0.8).
  • refineMethod (string, optional): Select the refinement style to apply (default: "no_refiner").
  • loraScale (number, optional): LoRA additive scale factor (default: 0.6).
  • applyWatermark (boolean, optional): If true, applies a watermark to the generated image (default: true).

Example Input:

{
  "width": 1024,
  "height": 1024,
  "prompt": "A scribbled art drawing of a TOK astronaut portrait",
  "loraScale": 0.6,
  "refineMethod": "no_refiner",
  "guidanceScale": 7.5,
  "applyWatermark": true,
  "promptStrength": 0.8,
  "numberOfOutputs": 1
}

Output

The action returns a URL to the generated scribbled art image. Here’s an example of what you might receive:

Example Output:

[
  "https://assets.cognitiveactions.com/invocations/af823af0-0a87-45bc-8350-0d30aff30880/9f30ad01-fbde-429b-8c6f-84a57b6efb35.png"
]

Conceptual Usage Example (Python)

Here’s how you might call the Generate Scribbled Art Drawing action using Python. This example constructs the input payload and makes a request to a hypothetical 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 = "aa56e241-8bd3-47dd-81f4-2e81ad01223a"  # Action ID for Generate Scribbled Art Drawing

# Construct the input payload based on the action's requirements
payload = {
    "width": 1024,
    "height": 1024,
    "prompt": "A scribbled art drawing of a TOK astronaut portrait",
    "loraScale": 0.6,
    "refineMethod": "no_refiner",
    "guidanceScale": 7.5,
    "applyWatermark": True,
    "promptStrength": 0.8,
    "numberOfOutputs": 1
}

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 code snippet:

  • The action_id is set to the ID of the "Generate Scribbled Art Drawing" action.
  • The payload is constructed based on the required input schema.
  • The request is made to the hypothetical endpoint, and the response is printed upon success.

Conclusion

The brunnolou/scribble-art-portrait Cognitive Actions provide developers with powerful tools for generating unique artistic images. By utilizing these pre-built actions, you can enhance your applications with creative capabilities, inviting users to explore the boundaries of generative art. Now that you're equipped with the knowledge to implement these actions, consider experimenting with various prompts and settings to see the diverse outputs you can create!