DEV Community

Cover image for Transform Photos to Anime & Cartoon Styles with an API
AI Engine
AI Engine

Posted on • Originally published at ai-engine.net

Transform Photos to Anime & Cartoon Styles with an API

The Photo to Anime API transforms any photograph into a polished cartoon rendering in seconds — with 7 unique styles to choose from. No style transfer model to train, no GPU clusters to manage.

7 Unique Styles

  • Anime — Japanese anime with clean lines and vibrant colors
  • 3D — Smooth, Pixar-like 3D cartoon rendering
  • Hand-drawn — Organic illustration feel
  • Sketch — Pencil sketch with monochrome lines
  • Art Style — Artistic painting with bold strokes
  • Design — Flat, modern graphic design
  • Illustration — Detailed, colorful digital illustration

Python Example

import requests

API_URL = "https://phototoanime1.p.rapidapi.com/cartoonize"
HEADERS = {
    "x-rapidapi-host": "phototoanime1.p.rapidapi.com",
    "x-rapidapi-key": "YOUR_API_KEY",
}

# Upload a file with a style
with open("photo.jpg", "rb") as f:
    response = requests.post(
        API_URL,
        headers=HEADERS,
        files={"image": f},
        data={"style": "anime"},
    )

result = response.json()
print(result["image_url"])  # URL to the cartoon-styled JPEG
Enter fullscreen mode Exit fullscreen mode

You can also pass a URL instead of uploading:

response = requests.post(
    API_URL,
    headers={**HEADERS, "Content-Type": "application/json"},
    json={"image_url": "https://example.com/photo.jpg", "style": "3d"},
)
Enter fullscreen mode Exit fullscreen mode

The response includes image_url, width, height, and size_bytes. URLs expire after 24 hours.

Use Cases

  • Social media avatars — Let users upload a selfie and get a cartoon-style profile picture
  • Marketing campaigns — Transform product photos into cartoon styles for younger demographics
  • Game asset prototyping — Quickly generate character designs from reference photos
  • Personalized merchandise — Cartoon portraits on mugs, phone cases, posters

Tips

  • Use well-lit, high-resolution portraits for best results
  • Different styles suit different use cases: Anime/3D for avatars, Sketch for prints, Design for marketing
  • Processing takes 2-3 seconds — show a loading indicator
  • Cache results since URLs expire after 24h

👉 Read the full tutorial with cURL, JavaScript examples and all 7 styles

Top comments (0)