Create Stunning Custom Images with Simonng's Image Generation Action

26 Apr 2025
Create Stunning Custom Images with Simonng's Image Generation Action

In today’s digital landscape, the demand for unique and captivating visuals is at an all-time high. The Simonng service offers a powerful Cognitive Action that allows developers to generate customized images tailored to their specific needs. With features designed to optimize both speed and quality, Simonng’s image generation capabilities can transform your creative ideas into stunning visuals in mere moments.

This action is particularly beneficial for a variety of use cases, including creating marketing materials, enhancing visual storytelling, crafting personalized content for social media, and generating artwork for digital platforms. Whether you’re an artist looking to prototype ideas or a marketer aiming to capture your audience’s attention, Simonng’s image generation action simplifies the process of creating high-quality images that stand out.

Prerequisites

To get started with Simonng’s Cognitive Actions, you will need an API key for authentication and a fundamental understanding of making API calls.

Generate Custom Image

The Generate Custom Image action empowers users to create tailored images using specified parameters. This action supports both image-to-image transformations and inpainting, allowing for a high degree of customization in the outputs. By employing various models optimized for either speed or high quality, developers can choose the best fit for their project requirements.

Input Requirements

To utilize this action, you need to provide a prompt, which serves as the foundation for the image generation. Additionally, you can specify parameters such as:

  • mask (optional): An image mask for inpainting mode.
  • seed (optional): A random seed for reproducibility.
  • image (optional): An input image for image-to-image transformations.
  • model: Choose between "dev" for detailed outputs or "schnell" for faster results.
  • aspectRatio: Define the aspect ratio of the generated image.
  • outputFormat: Select the desired output format (e.g., PNG, JPG, WEBP).
  • inferenceStepsCount: Control the number of denoising steps for detail.

Expected Output

The output will be a generated image URL, which can be directly accessed to view or download the created image. For example:

[
  "https://assets.cognitiveactions.com/invocations/93385b1e-59b6-410b-9918-75c9468e3695/5bdee4c4-7c3c-4dba-bfae-cf9428e46ac0.png"
]

Use Cases for this specific action

  1. Marketing Campaigns: Quickly generate unique images for advertisements or social media posts that resonate with your target audience.
  2. Content Creation: Create custom visuals for blogs, articles, or websites that require specific imagery to enhance storytelling.
  3. Artistic Prototyping: Artists can use this action to visualize concepts and explore different styles or compositions without the need for extensive manual creation.
  4. Personalized Gifts: Generate custom images for personalized items or digital art that can be shared with friends and family.
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 = "45aa2afa-180b-413f-ba1b-ddee36a0b955" # 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",
  "prompt": "A cinematic, action-packed scene featuring HENRYHO as Neo and SIMONNG as Morpheus from The Matrix. Both characters are captured in a close-up shot, their intense expressions highlighting the gravity of the moment. HENRYHO, portraying Neo, wears the iconic black trench coat and sleek sunglasses, his gaze sharp and focused. Beside him, SIMONNG embodies Morpheus, donning the classic long leather coat, mirrored sunglasses, and exuding a calm yet commanding presence. The background is alive with cascading green Matrix code and a moody, futuristic cityscape. Dynamic elements like bullets suspended mid-air and swirling fragments of digital code add energy to the scene. The lighting casts dramatic shadows, emphasizing the contours of their faces and the tension of the moment. The camera angle centers on both characters, showcasing their partnership and capturing the thrilling essence of The Matrix in a visually stunning image.",
  "loraScale": 0.7,
  "aspectRatio": "1:1",
  "outputFormat": "png",
  "guidanceScale": 3.5,
  "outputQuality": 90,
  "additionalLora": "jaaacki/henryho",
  "promptStrength": 0.92,
  "numberOfOutputs": 1,
  "additionalLoraScale": 1,
  "inferenceStepsCount": 40
}

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

Simonng’s image generation action provides developers with a robust tool for creating custom visuals that can elevate any project. By harnessing the power of AI-driven image generation, you can save time, reduce costs, and enhance creativity in your work. Whether for marketing, content creation, or artistic endeavors, the possibilities are endless. Start exploring Simonng today and transform your ideas into stunning images!