Create Stunning Custom Images with Mnmzjan's AI Actions

27 Apr 2025
Create Stunning Custom Images with Mnmzjan's AI Actions

In the world of digital content creation, having the ability to generate high-quality images on demand can significantly enhance your projects and workflows. Mnmzjan provides a powerful set of Cognitive Actions focused on image generation, enabling developers to create custom images based on specific prompts and tailored requirements. With features like customizable image size, format, and model selection for optimized speed or accuracy, Mnmzjan simplifies the image creation process. This service supports LoRA weights, improving image quality and allowing for greater creative control.

Developers can leverage Mnmzjan's image generation capabilities in various scenarios, such as creating professional profile pictures, generating artwork for marketing materials, or producing unique visuals for social media campaigns. The flexibility and efficiency of these Cognitive Actions make them an essential tool for anyone seeking to enhance their visual content.

Prerequisites

To get started with Mnmzjan, you'll need an API key for the Cognitive Actions service and a basic understanding of making API calls.

Generate Custom Image

The Generate Custom Image action allows you to produce images based on specified text prompts and customizable parameters. This action is vital for developers who need to generate unique visuals quickly and efficiently.

Purpose

This action solves the problem of generating tailored images that meet specific requirements. Whether you need a quick visual for a blog post or a detailed image for a marketing campaign, this action provides the necessary tools to create high-quality images.

Input Requirements

The input for this action is structured as an object that includes several properties, with the prompt being the only required field. Other customizable parameters include:

  • mask: URI for an image mask used in image inpainting mode.
  • seed: Random seed for reproducible image generation.
  • image: URI for the input image for image-to-image or inpainting mode.
  • model: Selection between 'dev' for optimal performance or 'schnell' for faster generation.
  • width and height: Define the dimensions of the image when using a custom aspect ratio.
  • goFast: Enables faster prediction using a model optimized for speed.
  • aspectRatio: Sets the desired aspect ratio for the image.
  • outputFormat: Specifies the file format for the generated image.
  • numberOfOutputs: Determines how many images to generate.

Expected Output

The action will return a URL to the generated image, allowing you to easily access and utilize the visual content created.

Use Cases for this specific action

  • Professional Profile Pictures: Generate high-quality images for personal branding or professional use.
  • Marketing Materials: Create unique visuals tailored to specific campaigns or products.
  • Social Media Content: Quickly produce eye-catching images to enhance social media presence.
  • Art and Design Projects: Experiment with different styles and concepts for creative projects.
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 = "3a4f535e-a804-4f6e-9915-f983849c7e14" # Action ID for: Generate Custom Image

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "model": "dev",
  "goFast": false,
  "prompt": "Professional profile picture of bald MNMZJAN taken on dslr camera. Front shot. Blurred background. Bright contrast colors. Wearing t-shirt. Neutral facial expression.",
  "loraScale": 1,
  "megapixels": "1",
  "aspectRatio": "1:1",
  "outputFormat": "png",
  "guidanceScale": 3,
  "outputQuality": 80,
  "extraLoraScale": 1,
  "promptStrength": 0.79,
  "numberOfOutputs": 1,
  "numberOfInferenceSteps": 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

Mnmzjan's Cognitive Actions for image generation provide developers with powerful tools to create stunning visuals tailored to their needs. With customizable options and the ability to generate images quickly, these actions can significantly enhance your content creation workflow. Whether you're looking to produce professional images for business use or unique visuals for creative projects, Mnmzjan offers the flexibility and efficiency required to bring your ideas to life. Start exploring the capabilities of Mnmzjan today and transform your visual content creation process!