image-to-image (cartoonization / stylization) Β· vision Β· WASM Β· ~8 MB / style
Give this model any photo and it repaints it in a learned anime style β smoothed shading, bold outlines, painterly skies. AnimeGANv2 is a GAN trained to convert real photographs into the look of specific animators: Hayao (Ghibli-ish), Shinkai (Makoto Shinkai's luminous scenery), and Paprika (Satoshi Kon). It's not a colour filter β it re-draws the scene. Runs entirely on your device via ONNX Runtime Web; the photo never leaves the tab.
| Model | vumichien/AnimeGANv2_{Hayao,Shinkai,Paprika} β AnimeGANv2, one ONNX per style |
|---|---|
| Task | image-to-image (cartoonization / photoβanime style transfer) β run via raw ONNX Runtime Web (see note below) |
| Runtime | onnxruntime-web 1.21 (transformers.js has no AnimeGAN class / no stylization task) |
| Input | generator_input:0 [1, H, W, 3] float32 in β1β¦1 β NHWC (channels-last, TensorFlow export), H/W rounded to a multiple of 32 |
| Output | β¦/out_layer/Tanh:0 [1, H, W, 3] float32 in β1β¦1 β the anime repaint, mapped back to RGB |
| Quantization | fp32 ONNX (single file per style) β runs on the plain WASM execution provider, no WebGPU needed |
| Backend | WebAssembly (single-threaded on GitHub Pages) β ~1.3 s @256-px to ~5 s @512-px |
| Download | ~8.4 MB per style, cached after first load (styles load lazily; auto-inits on return) |
| License | Apache-2.0 |
| Web APIs | WebAssembly, Web Workers, OffscreenCanvas, ImageBitmap β all Baseline widely available |
Pick a photo, choose an anime style, and repaint it. Drag the divider to compare the photo with its anime version.
The wipe above is the real evidence β slide it to watch the scene turn to anime. βRestyle amountβ is the mean per-pixel change from the photo; a bold style (Paprika) moves it more than a subtle one, and it's far above what a colour filter would do.
Everything runs on your device β the photo and every stylized pixel never leave the tab. Gallery images are rights-cleared samples (see each caption for the source).
Style is a learned repaint, not a preset. The three styles were each trained on a different animator's films, so the same photo comes out differently: Hayao softens into gentle Ghibli pastels, Shinkai pushes saturated, luminous skies and rim-light, Paprika flattens into bold graphic colour. Switch styles below and re-run the same image to see how differently each model paints it.
Notice the model doesn't just recolour β it smooths flat regions, thickens edges into "line art", and repaints skies and foliage with painterly texture. That structural redraw is what makes it read as anime rather than a filtered photo.
Stylizing a photo on-device turns any picture into shareable art, privately and free per image:
AnimeGANv2 renders a stylistic interpretation β it's an artistic redraw, not a faithful reproduction, and fine text or faces may be simplified.
Pick a photo and a style, then anime-fy it β wipe between the photo and its anime version.
Make an anime avatar from your own photo and download it as a PNG.
Style-off: run all three styles on the same photo side by side and compare how each animator paints it.
Matte β anime: cut out the subject with background removal, then anime-fy just the subject onto a clean backdrop.
transformers.js has no AnimeGAN class and no stylization task, so we run the ONNX graph directly with ONNX Runtime Web. Note the NHWC (channels-last) layout and the β1β¦1 tanh range:
import * as ort from "onnxruntime-web";
const session = await ort.InferenceSession.create(styleBytes, { executionProviders: ["wasm"] });
// photo β [1,H,W,3] float32 in [-1,1] (NHWC, channels-last β it's a TensorFlow export)
const input = new ort.Tensor("float32", toNHWC(photo, H, W), [1, H, W, 3]);
const { ["β¦/out_layer/Tanh:0"]: out } = await session.run({ ["generator_input:0"]: input });
// out is [1,H,W,3] in [-1,1] β map (v+1)/2 back to RGB
const anime = tanhToImage(out.data, H, W);
Inference and the whole output composite run in a Web Worker so the UI never blocks; each ~8 MB style is fetched through Cache Storage the first time you pick it, so a returning visit auto-initialises with no re-download.