An enterprise-grade cartoonization engine built with PyTorch, AnimeGANv2, and OpenCV. Features a responsive Web Studio with live Before/After comparison, a zero-lag Desktop GUI, and a developer-first CLI & Python SDK.
Test our real-time computer vision shaders right in your browser canvas or drop your own photo!
Everything you need from high-definition artistic filters to automated batch CLI pipelines.
Integrates official AnimeGANv2 PyTorch Hub checkpoints alongside fine-tuned artistic Ghibli shaders for lush hand-painted lighting.
Automatically detects facial landmarks and applies proportional expansion with soft feathered elliptical blending to preserve identity.
Zero-configuration single-page web app built on FastAPI with interactive split slider, webcam snapshot modal, and drag-and-drop.
Responsive cross-platform desktop application powered by modern Tkinter and asynchronous background worker threads.
Process thousands of photos in seconds. Available via the Web Studio with instant ZIP download or through high-speed CLI commands.
Clean, modular, and type-annotated Python API (from cartoonify import CartoonEngine) with 100% test coverage.
Mathematical formulations and computer vision pipelines powering our 12 distinct filters.
Preserves sharp edge gradients while smoothing surface noise by evaluating geometric spatial distance $g_s$ and radiometric pixel intensity distance $g_r$ concurrently.
I_smooth(x) = (1/W_p) * ฮฃ I(x_i) * g_s(||x_i - x||) * g_r(||I(x_i) - I(x)||)
Computes a 1.6x expanded centroid bounding box around detected facial coordinates and applies an elliptical Gaussian falloff to eliminate square border seams.
Alpha(x, y) = exp(- ( (x - cx)ยฒ / (2*ฯxยฒ) + (y - cy)ยฒ / (2*ฯyยฒ) ) )
Converts to grayscale, computes negative Gaussian blur inversion, and executes high-speed Color Dodge matrix arithmetic for realistic graphite line crosshatching.
I_sketch(x,y) = min(255, (I_gray * 256) / (255 - I_inv_blur + 1))
Reduces continuous color spectrum to $K=8\dots16$ dominant cluster centroids in RGB space, producing authentic flat cell-shaded comic coloring.
argmin ฮฃ || pixel_i - centroid_k ||ยฒ
Operates exclusively on the Luminance channel $L$ in CIE-LAB space with clip limit $2.0$ over an $8\times 8$ grid, preventing unnatural color shift artifacts.
L_enhanced = CLAHE(L_channel, clipLimit=2.0, tileGrid=(8,8))
Computes horizontal and vertical spatial derivatives ($\partial I/\partial x, \partial I/\partial y$) to simulate fluid watercolor pigment accumulation along borders.
Gradient_Mag = sqrt( (dI/dx)ยฒ + (dI/dy)ยฒ )
Tested and verified against adversarial payloads, memory exhaustion, and path injection (50/50 Passed).
../../, \x00 null bytes & special chars.tests/test_api.py ......................... PASSED
tests/test_cli.py ......................... PASSED
tests/test_engine.py ...................... PASSED
tests/test_filters.py ..................... PASSED
tests/test_security.py (25 Fuzz Vectors) .. PASSED
=================== 50 passed in 56.43s ===================
Engineered for portrait photographs, landscapes, architectural shots, and anime character art.
ChatGPT-grade generative AI synthesis. Reimagines your photo with hand-painted Miyazaki eyes, hair, and watercolor clouds.
Trained directly on Miyazaki film frames. Vivid emerald foliage, azure skies, and painterly cel-shading.
Instant zero-lag computer vision shader with warm afternoon sunlight and smooth anti-aliased pencil inking.
Deep rich saturation, bold cinematic shadows, and vivid illustrative coloring.
Graphic novel aesthetic with thick black ink contours and cell-shaded primary colors.
Soft fluid pigment wash, fluid color bleeding, and gentle canvas texture.
Electric cyan and magenta glowing contours over dark high-contrast silhouettes.
Designed for developers, ML engineers, and automation workflows.
from cartoonify import CartoonEngine
# Initialize the engine (automatically selects CUDA GPU or CPU)
engine = CartoonEngine()
# 1. ChatGPT-Grade Generative AI Studio Ghibli Synthesis
engine.process_file(
"portrait.jpg",
"ghibli_chatgpt_art.jpg",
style="ghibli_generative",
custom_params={"openai_api_key": "your-openai-api-key"}
)
# 2. Local Neural Hayao Miyazaki Model (AnimeGANv2)
engine.process_file(
"portrait.jpg",
"ghibli_hayao_art.jpg",
style="hayao",
use_face_align=True
)
# 3. High-Speed Kuwahara Painterly Filter (100% Offline)
engine.process_file(
"portrait.jpg",
"ghibli_kuwahara.jpg",
style="ghibli_pro",
strength=0.85
)
# Transform a single image
python -m cartoonify process photo.jpg -o cartoon.jpg --style ghibli_pro --strength 0.85
# Enable face-aligned feathered blend for portraits
python -m cartoonify process selfie.jpg -o selfie_anime.jpg --style anime_soft --face-align
# Batch process an entire directory of photos
python -m cartoonify batch ./my_vacation_photos -o ./cartoons --style comic_pop
# Launch the Web Studio UI
python -m cartoonify web --port 8000
# Launch the Desktop GUI
python -m cartoonify gui
# 1. Process image via multipart form upload
curl -X POST "http://localhost:8000/api/process-upload" \
-F "file=@portrait.jpg" \
-F "style=ghibli_pro" \
-F "strength=0.85" \
--output cartoon_result.jpg
# 2. Query available styles catalog
curl -X GET "http://localhost:8000/api/styles"
# 3. Health & Device diagnostic check
curl -X GET "http://localhost:8000/api/health"
from pathlib import Path
from cartoonify import CartoonEngine
engine = CartoonEngine()
photos = list(Path("./input_photos").glob("*.jpg"))
def on_progress(current, total, filename):
print(f"[{current}/{total}] Processed: {Path(filename).name}")
results = engine.process_batch(
photos,
output_dir="./cartoon_gallery",
style="watercolor",
strength=0.8,
progress_callback=on_progress
)
print(f"Successfully cartoonified {len(results)} images!")
Seamless multi-stage pipeline balancing neural inference, morphological contouring, and feathered masking.
Loads RGB/BGR image from file, webcam stream, or Base64 buffer with automatic aspect ratio clamping.
Haar cascade locates the primary portrait face, scales bounding box by 1.6x, and builds feathered alpha mask.
Applies AnimeGANv2 PyTorch weights or Ghibli multi-pass bilateral filtering and K-Means color quantization.
LAB CLAHE contrast enhancement, unsharp mask clarity, and feathered composite reconstruction.
Clone the repository and launch the app in less than 60 seconds.
No terminal commands needed. Simply double-click any launcher in the repository root:
run_web.bat โ Starts the interactive Web Studiorun_gui.bat โ Starts the modern Desktop GUIrun_tests.bat โ Runs the 50/50 test suiterun_showcase_website.bat โ Opens this website locally# Option 1: Standard Python Setup
git clone https://github.com/AryanXCode646/cartoon-image-generator67.git
cd cartoon-image-generator67
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python -m cartoonify web
# Option 2: Docker Container
docker-compose up -d