Create Stunning Artistic Circles with Moon's Image Generation

26 Apr 2025
Create Stunning Artistic Circles with Moon's Image Generation

In the world of digital art, the ability to generate unique and captivating images can open up endless creative possibilities. The "Moon" service offers developers a powerful set of Cognitive Actions that allows for the creation of artistic circle images inspired by the enchanting "Month of the Moon" illustrations by Anne Milan. By leveraging advanced image generation techniques, developers can produce stunning visuals quickly and efficiently, enhancing their projects with unique artistic flair.

Whether you're looking to create illustrations for a children's book, design elements for a website, or simply explore the realms of digital creativity, the Moon service simplifies the process, allowing you to focus on your artistic vision.

Prerequisites

To get started with the Moon service, you'll need an API key for Cognitive Actions and some basic knowledge of making API calls.

Generate Artistic Circles

The "Generate Artistic Circles" action is designed to create vibrant and imaginative circle images. This action utilizes a trained model that incorporates various artistic styles, enabling users to customize their outputs through options like img2img, inpainting, and different refinement styles.

Input Requirements

To use this action, you'll need to provide the following inputs:

  • Prompt: A descriptive text prompt that guides the image generation (e.g., "In the style of AMYB a circle with flowers").
  • Image: An input image URL for image-to-image or inpainting modes.
  • Mask: An input mask for inpainting, where black areas are preserved and white areas are inpainted.
  • Width and Height: Define the dimensions of the output image (default is 1024x1024 pixels).
  • Refine Style: Choose from options like 'no_refiner', 'expert_ensemble_refiner', or 'base_image_refiner'.
  • Scheduler Type: Select the algorithm for image generation (default is 'K_EULER').
  • Number of Outputs: Specify how many images to generate (between 1 and 4).
  • Prompt Influence: Control the strength of the input prompt's influence on the output image.

Expected Output

The output will be a URL link to the generated artistic circle image, which can be used directly in your projects or for further refinement.

Use Cases for this Action

This action is ideal for:

  • Artists and Designers: Create unique artworks or design elements that can be integrated into various projects.
  • Marketing and Advertising: Generate eye-catching visuals that can enhance promotional materials and social media posts.
  • Game Development: Produce engaging graphics for game assets, character designs, or backgrounds.
  • Content Creators: Generate custom images for blogs, articles, or digital publications, adding a personalized touch.
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 = "25f0e823-a60d-42fa-9521-434a56a1cd00" # Action ID for: Generate Artistic Circles

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "width": 1024,
  "height": 1024,
  "prompt": "In the style of AMYB a circle with flowers",
  "refine": "no_refiner",
  "scheduler": "K_EULER",
  "opposingPrompt": "",
  "numberOfOutputs": 1,
  "promptInfluence": 0.8,
  "includeWatermark": true,
  "highNoiseFraction": 0.8,
  "inferenceStepCount": 50,
  "guidanceScalingFactor": 7.5,
  "localizationRegularizationScale": 0.6
}

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

With the Moon service's "Generate Artistic Circles" action, developers can easily create stunning, customized images that cater to a variety of artistic needs. Its flexibility and extensive options empower creativity while simplifying the image generation process. Whether for personal projects or professional applications, the Moon service enhances the way you approach digital artistry. Start integrating these capabilities into your projects today and unlock a new realm of creative potential!