Create Stunning Hand-Drawn Sketch Illustrations with Enna Sketch Style

Enna Sketch Style is a powerful Cognitive Actions service that enables developers to generate beautiful hand-drawn sketch illustrations effortlessly. By leveraging advanced image generation techniques, this service supports various creative applications, allowing for both image-to-image transformations and inpainting. The unique character of the generated sketches is enhanced by a distinctive shakiness in linework, giving each illustration an artistic flair that mimics the charm of traditional sketching. With its capability to handle custom dimensions and style mixing, Enna Sketch Style simplifies the creative process, enabling developers to produce high-quality visuals quickly and efficiently.
Common use cases for Enna Sketch Style include enhancing digital art projects, creating personalized illustrations for marketing materials, and generating unique graphics for social media campaigns. Whether you're a game developer looking to create character sketches or a content creator aiming for eye-catching visuals, this service can elevate your projects with minimal effort.
Prerequisites
To get started, you'll need a Cognitive Actions API key and a basic understanding of making API calls.
Generate Sketch Illustration
The Generate Sketch Illustration action is designed to create hand-drawn style illustrations based on user-defined prompts. This action is particularly useful for artists, designers, and developers who want to add a unique artistic touch to their projects.
Purpose
This action generates a sketch illustration using the LoRA character sketch-illustration model. It offers image-to-image and inpainting modes, allowing for a high degree of customization in both dimensions and artistic style. The model’s unique shakiness in linework enhances the authenticity of the sketches, making them visually appealing.
Input Requirements
To utilize this action, you need to provide the following inputs:
- prompt: A descriptive string that outlines what the sketch should depict (required).
- image: A URI to an input image if you want to use image-to-image or inpainting modes (optional).
- mask: A URI for an image mask to specify areas for inpainting (optional).
- width and height: Specify custom dimensions for the generated image if required.
- model: Choose between "dev" and "schnell" for different inference speeds and qualities.
- Additional parameters like guidanceScale, numOutputs, and outputFormat allow for further customization.
Expected Output
The expected output is a series of generated images in the specified format (e.g., webp, jpg, png). The output will consist of multiple sketches based on the input prompt, tailored to your specific requirements.
Use Cases for this Specific Action
- Character Design: Developers can create unique character sketches for video games or animations, helping to visualize concepts quickly.
- Custom Illustrations: Marketers can generate personalized illustrations for campaigns, enhancing engagement with visually appealing content.
- Artistic Projects: Artists can use this action to experiment with different styles and prompts, producing diverse sketches for portfolios or commissions.
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 = "f33e453d-1112-45e2-8bc0-7cf322d01f98" # Action ID for: Generate Sketch Illustration
# 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": " whimsical artist with rainbow-colored hair, paint-splattered overalls, and a paintbrush tucked behind their ear., sketch illustration style",
"loraScale": 1,
"numOutputs": 4,
"aspectRatio": "1:1",
"outputFormat": "webp",
"guidanceScale": 3.5,
"outputQuality": 80,
"extraLoraScale": 0.8,
"numInferenceSteps": 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
Enna Sketch Style offers a versatile and efficient way to generate hand-drawn illustrations, making it an invaluable tool for developers and creatives alike. Its ability to produce high-quality, customized sketches from simple prompts opens up a realm of possibilities for various applications, from digital art to marketing content. To get started, integrate the Generate Sketch Illustration action into your workflow and explore the creative potential it unlocks.