Create Stunning Art with Ingres Portrait Generation

26 Apr 2025
Create Stunning Art with Ingres Portrait Generation

Creating realistic and captivating portraits has never been easier than with the Ingres Cognitive Actions. This powerful image-generation service allows developers to leverage the artistic style of Jean-Auguste-Dominique Ingres to produce high-quality, stylized portraits. By simply incorporating the keyword 'NGRS' into your prompts, you can guide the AI to create images that reflect Ingres's iconic techniques and aesthetics.

With the Ingres Portraits model, you can enjoy rapid generation of images with adjustable attributes such as resolution, aspect ratio, and output format. This flexibility opens the door to a variety of creative applications, making it ideal for artists, designers, and developers looking to integrate unique visual content into their projects. Common use cases include generating artwork for digital media, creating personalized gifts, or even enhancing user interfaces with custom art.

Prerequisites

To get started with the Ingres Portraits model, you'll need a Cognitive Actions API key and a basic understanding of making API calls.

Generate Ingres Portraits

The "Generate Ingres Portraits" action is designed to create stunning portraits inspired by the classical style of Ingres. This action solves the problem of generating high-quality art quickly and easily, allowing developers to focus on creativity rather than technical details.

Input Requirements

The action requires a structured input with essential fields, notably:

  • Prompt: A descriptive text that guides the image generation, such as "Portrait du comte d'Hauteville par Jean-Auguste-Dominique Ingres, 1835, in the style of NGRS..."
  • Fast Mode: Option to enable faster image generation.
  • Output Count: Number of images to generate (1 to 4).
  • Inference Model: Choose between 'dev' for better quality or 'schnell' for speed.
  • Additional parameters such as aspect ratio, image quality, and guidance levels provide further customization.

Expected Output

The output will be a high-quality image URL that reflects the input prompt and specified attributes. For example, you might receive a link to a beautifully rendered portrait in the chosen style and format.

Use Cases for this specific action

Developers can utilize this action in various scenarios, including:

  • Artistic Projects: Generate unique artwork for exhibitions, websites, or social media.
  • Personalized Gifts: Create custom portraits for friends or family based on specific themes or styles.
  • Game Development: Integrate stylized portraits for character design or narrative elements.
  • Marketing Materials: Enhance brochures, ads, or online content with captivating visuals.
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 = "fc418a6d-7bee-4b6b-8e12-e984991b781e" # Action ID for: Generate Ingres Portraits

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "prompt": "Portrait du comte d'Hauteville par Jean-Auguste-Dominique Ingres, 1835, in the style of NGRS, oil on canvas, cracked varnish",
  "fastMode": true,
  "outputCount": 1,
  "inferenceModel": "dev",
  "imageMegapixels": "1",
  "imageAspectRatio": "1:1",
  "primaryLoraScale": 1,
  "imageOutputFormat": "webp",
  "guidanceLevelScale": 2,
  "imageOutputQuality": 80,
  "inferenceStepCount": 20,
  "additionalLoraScale": 1,
  "imagePromptStrength": 0.8
}

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

The Ingres Portraits model provides an exceptional opportunity for developers to harness the beauty of classical art in a modern context. By simplifying the process of generating stunning images, it allows for a wide range of creative applications. Whether you're looking to enhance your projects with unique visuals or create personalized art pieces, the Ingres Cognitive Actions can elevate your work to new artistic heights. Start experimenting with the Ingres Portraits model today and unlock your creative potential!