Generate Stunning 4K Images with franfernandez93 Cognitive Actions

In today's digital landscape, high-quality images are crucial for engaging content. The franfernandez93/generador_imagen_4k API offers powerful Cognitive Actions designed to help developers generate stunning 4K images tailored to specific prompts. With the flexibility to adjust parameters like aspect ratio, dimensions, and model type, these pre-built actions simplify the image creation process, making it accessible for various applications, from marketing to gaming.
Prerequisites
Before diving into the integration of Cognitive Actions, ensure you have:
- An API key for the Cognitive Actions platform.
- Basic knowledge of JSON structure and HTTP requests.
You will typically authenticate by including your API key in the request headers, allowing you to securely access the image generation functionalities offered by the platform.
Cognitive Actions Overview
Generate Image with 4K Quality
The Generate Image with 4K Quality action allows developers to create high-definition images based on descriptive prompts. It supports various customization options, enabling you to fine-tune aspects like resolution, output format, and the model used for inference.
- Category: image-generation
Input
The action requires a JSON payload that includes the following fields:
| Field | Type | Description |
|---|---|---|
prompt | string | Text prompt to guide image generation. Required field. |
width | integer | Width of the generated image in pixels (256 - 1440). Rounded to the nearest multiple of 16. Not compatible with fast mode. |
height | integer | Height of the generated image in pixels (256 - 1440). Rounded to the nearest multiple of 16. Not compatible with fast mode. |
numOutputs | integer | Number of images to generate in a single request (1 - 4). |
guidanceScale | number | Guidance intensity for the diffusion process (0 - 10). Lower values yield more realistic images. |
outputQuality | integer | Quality level for output images (0 - 100). Higher values produce better quality. |
inferenceModel | string | Select the model used for inference; options are "dev" or "schnell". |
enableFastMode | boolean | Toggle for fast prediction mode. |
| Additional fields | Various | Includes options for aspect ratio, image format, and additional LoRA settings. |
Example Input:
{
"width": 785,
"height": 642,
"prompt": "The image features a stylized and strong character named TOK frfer93, designed in a minimalist and modern style. He wears a tech-inspired T-shirt with a subtle geeky touch. TOK frfer93 is holding an analysis board displaying \"Data Analysis with Power BI\" in a clear, professional font. The board also features the Power BI logo, along with sample Power BI visuals or data tables subtly integrated into the design.\n\nIn the background, wind turbines are visible, symbolizing the integration of renewable energy in the project. The color palette includes shades of dark blue, black, and white, with vibrant accents to maintain visual appeal. The name 'franfernandez93' appears prominently in a modern, tech-inspired font. The design maintains a professional and trustworthy look, ideal for a GitHub repository focused on data analysis with Power BI in the renewable energy sector.",
"loraScale": 1,
"numOutputs": 4,
"guidanceScale": 3,
"outputQuality": 80,
"enableFastMode": false,
"inferenceModel": "dev",
"promptStrength": 0.92,
"imageResolution": "1",
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp",
"numInferenceSteps": 28,
"additionalLoraScale": 1
}
Output
The action returns an array of URLs pointing to the generated images. The URLs can be accessed directly to retrieve the images created based on the provided prompt.
Example Output:
[
"https://assets.cognitiveactions.com/invocations/afcedbc4-ce82-48b6-a04b-78818139b369/e7f409d7-de4c-4abe-96e0-053e9f8082bb.webp",
"https://assets.cognitiveactions.com/invocations/afcedbc4-ce82-48b6-a04b-78818139b369/a19ea905-630e-4655-80ed-e0de78e6771c.webp",
"https://assets.cognitiveactions.com/invocations/afcedbc4-ce82-48b6-a04b-78818139b369/e94729a6-dab2-445f-bea4-dd984ab15a8e.webp",
"https://assets.cognitiveactions.com/invocations/afcedbc4-ce82-48b6-a04b-78818139b369/742010de-6fa4-4665-8497-ef55af6d955d.webp"
]
Conceptual Usage Example (Python)
Here's how you might call the Generate Image with 4K Quality action using Python:
import requests
import json
# Replace with your Cognitive Actions API key and endpoint
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute" # Hypothetical endpoint
action_id = "06211f81-67d1-4548-9e8d-459fe4583f41" # Action ID for Generate Image with 4K Quality
# Construct the input payload based on the action's requirements
payload = {
"width": 785,
"height": 642,
"prompt": "The image features a stylized and strong character named TOK frfer93, designed in a minimalist and modern style. He wears a tech-inspired T-shirt with a subtle geeky touch. TOK frfer93 is holding an analysis board displaying \"Data Analysis with Power BI\" in a clear, professional font. The board also features the Power BI logo, along with sample Power BI visuals or data tables subtly integrated into the design.\n\nIn the background, wind turbines are visible, symbolizing the integration of renewable energy in the project. The color palette includes shades of dark blue, black, and white, with vibrant accents to maintain visual appeal. The name 'franfernandez93' appears prominently in a modern, tech-inspired font. The design maintains a professional and trustworthy look, ideal for a GitHub repository focused on data analysis with Power BI in the renewable energy sector.",
"loraScale": 1,
"numOutputs": 4,
"guidanceScale": 3,
"outputQuality": 80,
"enableFastMode": false,
"inferenceModel": "dev",
"promptStrength": 0.92,
"imageResolution": "1",
"imageAspectRatio": "1:1",
"imageOutputFormat": "webp",
"numInferenceSteps": 28,
"additionalLoraScale": 1
}
headers = {
"Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
"Content-Type": "application/json"
}
try:
response = requests.post(
COGNITIVE_ACTIONS_EXECUTE_URL,
headers=headers,
json={"action_id": action_id, "inputs": payload} # Hypothetical structure
)
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
result = response.json()
print("Action executed successfully:")
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: {e.response.text}")
In this snippet:
- Replace
YOUR_COGNITIVE_ACTIONS_API_KEYwith your actual API key. - The
payloadvariable contains the input structure required by the action. - The response is handled to print the generated image URLs or any errors encountered during the request.
Conclusion
The franfernandez93/generador_imagen_4k API provides powerful tools for generating high-quality 4K images tailored to specific needs. By leveraging these Cognitive Actions, developers can enhance their applications with stunning visual content. Whether for marketing, storytelling, or creative projects, the possibilities are endless. Start integrating these actions today to elevate your image generation capabilities!