Photo to Cartoon Agent Skill
Photo to Cartoon Agent Skill
Add photo-to-cartoon transformation capabilities to your AI agents with this AI Pass skill. This skill enables agents to convert photographs into high-quality cartoon-style artwork.
Skill Overview
The Photo to Cartoon skill allows agents to:
- Transform photos into cartoon-style images
- Apply multiple cartoon art styles
- Preserve subject likeness while cartoonizing
- Create fun, eye-catching cartoon portraits
Installation
Add this skill to your agent configuration:
{
"skills": [
{
"name": "photo-cartoon",
"version": "1.0.0",
"enabled": true
}
]
}
Skill Content
// Photo to Cartoon Skill
// Get your API key from: https://aipass.one/developer/api-keys
const PHOTO_CARTOON_SKILL = {
name: "photo-cartoon",
description: "Transform photos into cartoon-style artwork using AI",
version: "1.0.0",
apiEndpoint: "https://aipass.one/api/v1/models/gpt-5-mini/completions",
styles: {
"classic-comic": {
name: "Classic Comic",
description: "Bold outlines, flat colors, traditional comic book look",
characteristics: "thick black outlines, vibrant flat colors, halftone patterns"
},
"modern-anime": {
name: "Modern Anime",
description: "Soft shading, vibrant colors, contemporary anime aesthetic",
characteristics: "smooth gradients, large expressive eyes, clean lines"
},
"caricature": {
name: "Caricature",
description: "Exaggerated features, fun and expressive cartoon style",
characteristics: "proportional exaggeration, expressive expressions, playful"
},
"minimalist": {
name: "Minimalist",
description: "Simple shapes, clean lines, minimal detail cartoon",
characteristics: "basic shapes, reduced detail, clean aesthetic"
},
"retro-cartoon": {
name: "Retro Cartoon",
description: "Vintage animation style, warm tones, nostalgic feel",
characteristics: "sepia/warm tones, hand-drawn texture, classic animation look"
}
},
async execute(imageData, cartoonStyle = "modern-anime") {
const apiKey = "$AIPASS_API_KEY"; // Replace with your API key from developer dashboard
const styleInfo = this.styles[cartoonStyle] || this.styles["modern-anime"];
const response = await fetch(this.apiEndpoint, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${apiKey}`
},
body: JSON.stringify({
model: "gpt-5-mini",
temperature: 1,
max_tokens: 16000,
messages: [
{
role: "system",
content: `You are an artistic image processing assistant specializing in photo-to-cartoon transformation. Convert photographs into high-quality cartoon-style artwork. Transform to "${styleInfo.name}" style: ${styleInfo.description}. Key characteristics: ${styleInfo.characteristics}. Preserve the subject's likeness and personality while applying cartoon effects.`
},
{
role: "user",
content: `Transform this photo to ${styleInfo.name} cartoon style: ${imageData}`
}
]
})
});
const result = await response.json();
return result;
},
getAvailableStyles() {
return Object.keys(this.styles).map(key => ({
id: key,
...this.styles[key]
}));
},
examples: [
{
input: "base64_image_data",
cartoonStyle: "modern-anime",
output: {
cartoonImage: "base64_cartoon_image",
style: "modern-anime",
styleName: "Modern Anime",
confidence: 0.95
}
}
]
};
// Export for use in agents
if (typeof module !== "undefined" && module.exports) {
module.exports = PHOTO_CARTOON_SKILL;
}
Usage in Your Agent
// Import the skill
const photoCartoon = require('./photo-cartoon-skill');
// Use the skill in your agent
async function cartoonizePhoto(imageData, style) {
try {
const availableStyles = photoCartoon.getAvailableStyles();
const styleIds = availableStyles.map(s => s.id);
if (!styleIds.includes(style)) {
throw new Error(`Invalid style. Available: ${styleIds.join(", ")}`);
}
const result = await photoCartoon.execute(imageData, style);
return {
success: true,
cartoonImage: result.choices[0].message.content,
style: style
};
} catch (error) {
return {
success: false,
error: error.message
};
}
}
Getting Your API Key
- Go to the AI Pass Developer Dashboard
- Navigate to API Keys
- Click "Generate New Key"
- Copy your API key
- Replace
$AIPASS_API_KEYin the skill code with your actual key
Security Note: Never hardcode your API key in client-side code. Use environment variables or secure server-side storage.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| imageData | string | Yes | Base64-encoded image data |
| cartoonStyle | string | No | Cartoon style (default: "modern-anime") |
Available Cartoon Styles
| Style ID | Name | Description |
|---|---|---|
| classic-comic | Classic Comic | Bold outlines, flat colors |
| modern-anime | Modern Anime | Soft shading, vibrant colors |
| caricature | Caricature | Exaggerated, expressive |
| minimalist | Minimalist | Simple shapes, clean lines |
| retro-cartoon | Retro Cartoon | Vintage animation style |
Response Format
{
"id": "completion-123",
"object": "text.completion",
"created": 1234567890,
"model": "gpt-5-mini",
"choices": [
{
"message": {
"role": "assistant",
"content": "base64_encoded_cartoon_image"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 1345,
"completion_tokens": 678,
"total_tokens": 2023
}
}
Best Practices
- Image quality - Clear, well-lit photos produce best results
- Simple backgrounds - Helps cartoon effect stand out
- Single subjects - Portraits work especially well
- Neutral expressions - Easier to cartoonize naturally
- High resolution - More detail means better cartoon results
Example Agent Integration
class CartoonTransformationAgent {
constructor(apiKey) {
this.skill = PHOTO_CARTOON_SKILL;
}
async cartoonize(imageData, style) {
const result = await this.skill.execute(imageData, style);
return result;
}
async suggestStyle(useCase) {
// Suggest appropriate cartoon style based on use case
const styleSuggestions = {
avatar: "modern-anime",
comic: "classic-comic",
fun: "caricature",
clean: "minimalist",
vintage: "retro-cartoon"
};
return styleSuggestions[useCase] || "modern-anime";
}
getAvailableStyles() {
return this.skill.getAvailableStyles();
}
async batchCartoonize(imageDataArray, style) {
const results = [];
for (const imageData of imageDataArray) {
const result = await this.cartoonize(imageData, style);
results.push(result);
}
return results;
}
}
Use Cases
- Social media avatars - Create unique cartoon profile pictures
- Branding - Generate consistent cartoon brand imagery
- Content creation - Add cartoon elements to posts and videos
- Personal projects - Transform family photos into cartoons
- Gifts - Create personalized cartoon portraits
Photo Recommendations
Best results with:
- Clear, well-lit portraits
- Simple, uncluttered backgrounds
- Neutral or natural expressions
- Single subjects
- High-resolution images (at least 500x500px)
Challenging subjects:
- Multiple people or complex group shots
- Busy, detailed backgrounds
- Extreme lighting (harsh shadows, overexposed)
- Very low resolution images
Pricing
Usage is based on API credits. Check the AI Pass pricing page for current rates.
Support
For issues or questions, visit the AI Pass documentation or contact support.
Transform photos into fun cartoons with AI! 🎨🖼️😊