Create Stunning Images with Makgustav's AI Image Generation

26 Apr 2025
Create Stunning Images with Makgustav's AI Image Generation

In the realm of digital creativity, the Makgustav service offers powerful Cognitive Actions designed to generate high-quality images tailored to your specifications. By leveraging the Ma.K Gustav Suit Model, developers can easily create stunning visuals with customizable parameters such as width, height, prompts, and refinement processes. This capability simplifies the image generation process, enabling developers to focus on creativity rather than technical complexities.

Common use cases for Makgustav include generating unique artwork for marketing campaigns, creating visual content for social media, and producing custom illustrations for websites or applications. Whether you're an artist looking for inspiration or a developer seeking to automate image creation, Makgustav provides the tools to transform your ideas into visual reality.

Prerequisites

To get started with Makgustav, you will need a valid Cognitive Actions API key and a basic understanding of making API calls.

Generate Image with Ma.K Gustav Model

This action allows you to generate images using the Ma.K Gustav Suit Model, offering a range of customizable parameters to achieve your desired outputs. The action is particularly useful for creating unique images based on specific prompts while providing options for refinement and inpainting.

Input Requirements: The input schema for this action includes various parameters:

  • mask: URI of the input mask for inpaint mode.
  • seed: Random seed for image generation.
  • image: URI of the input image for img2img or inpaint mode.
  • width: Width of the output image in pixels (default: 1024).
  • height: Height of the output image in pixels (default: 1024).
  • prompt: Text prompt guiding the image generation.
  • refine: Specifies the refinement strategy (default: no_refiner).
  • loraScale: Additive scale for LoRA (default: 0.6).
  • scheduler: Scheduler algorithm for denoising steps (default: K_EULER).
  • numOutputs: Number of images to generate (default: 1).
  • guidanceScale: Scale factor for classifier-free guidance (default: 7.5).
  • highNoiseFrac: Fraction of noise for the expert ensemble refiner (default: 0.8).
  • applyWatermark: Include a watermark in generated images (default: true).
  • negativePrompt: Elements to exclude from the generated image.
  • promptStrength: Influence level of the prompt (default: 0.8).
  • numInferenceSteps: Total denoising steps during generation (default: 50).
  • disableSafetyChecker: Option to disable the safety checker for images.

Expected Output: The action returns a URI link to the generated image, allowing you to easily access and utilize the visual content in your projects.

Use Cases for this specific action:

  • Generate unique artwork or illustrations based on specific themes or concepts.
  • Create variations of existing images by utilizing img2img capabilities.
  • Automate the production of images for marketing materials, enhancing visual storytelling.
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 = "16f7904a-2173-4ad8-9659-367953267dba" # Action ID for: Generate Image with Ma.K Gustav Model

# 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": "a man in a gustav,",
  "refine": "no_refiner",
  "loraScale": 0.6,
  "scheduler": "K_EULER",
  "numOutputs": 1,
  "guidanceScale": 7.5,
  "highNoiseFrac": 0.8,
  "applyWatermark": true,
  "negativePrompt": "",
  "promptStrength": 0.8,
  "numInferenceSteps": 50
}

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

Makgustav's image generation capabilities empower developers to create stunning visuals with ease and flexibility. With customizable parameters and various use cases, the service is ideal for anyone looking to enhance their digital content creation workflow. Start experimenting with Makgustav today to unlock new creative possibilities!