🎨 sanana
Turn your photos into Ghibli-style illustrations in one command
Local · Private · CPU-only · No GPU needed
English | 🌐 中文文档
✨ Showcase
| Original | 🪄 sanana Magic |
🚀 One-Liner Start
# Install once
pip install sanana
sanana photo.jpg
# Or run without installing (requires uv)
uvx sanana photo.jpg
The model (~1.2GB) will be downloaded automatically on first run.
🔥 Highlights
| 🎨 | Cartoon Style Transfer | Photos → Ghibli/anime illustrations |
|---|---|---|
| 🏠 | Fully Local | No internet, no cloud upload, absolute privacy |
| 🐍 | Python Native | pybind11 C++ extension, inference inside Python process |
| 💻 | CPU-only | MNN high-performance engine, runs on ordinary machines |
| ⚡ | 10 Steps | Knowledge-distilled model, high quality with few steps |
| 📦 | Truly Ready-to-Use | pip install handles all dependencies automatically |
📦 Installation
Option 1: pip (Recommended)
pip install sanana
This automatically clones and builds MNN (requires git, cmake, C++ compiler).
Option 2: From Source
git clone https://github.com/vra/sanana.git
cd sanana
uv pip install -e ".[dev]"
🎮 Usage
CLI
# Minimal
sanana photo.jpg
# Custom output
sanana photo.jpg -o output.jpg
# Custom prompt
sanana photo.jpg --prompt "Ghibli style"
# Full args
sanana photo.jpg \
-o out.jpg \
--prompt "Convert to Ghibli style" \
--steps 10 \
--seed 42 \
--width 512 \
--height 512
| Argument | Description | Default |
|---|---|---|
input |
Input image path | Required |
-o, --output |
Output path | input_stem_cartoon.jpg |
--prompt |
Style prompt | Convert to a cartoon-style illustration |
--steps |
Inference steps | 10 |
--seed |
Random seed | 42 |
--width/--height |
Output size | 512x512 |
Python API
from sanana import edit_image
# One-shot
edit_image("./photo.jpg", steps=10, seed=42)
from sanana import SanaEditor
# Advanced: reuse model for batch processing
editor = SanaEditor(backend="cpu", memory_mode=2)
editor.load()
for img in ["a.jpg", "b.jpg", "c.jpg"]:
editor.run(
input_image=img,
output_image=img.replace(".jpg", "_cartoon.jpg"),
steps=10,
)
⚙️ Architecture
┌────────────────────────────────────────────┐
│ 🐍 Python Layer │
│ sanana (CLI / API) │
│ ↓ import │
│ sanana._sana_diffusion │
│ (pybind11 C++ Extension) │
└────────────────────┬───────────────────────┘
│
┌────────────────────▼───────────────────────┐
│ 🔧 C++ Layer (MNN) │
│ SanaLlm ──→ SanaDiffusion ──→ Image │
│ (Text Encode) (Flow Matching Denoise) │
└────────────────────────────────────────────┘
- Text Encoding: Qwen3-0.6B LLM processes the prompt
- Feature Bridging: Connector → Projector maps to DiT space
- VAE Encode: Input image → Latent (img2img)
- DiT Denoise: Euler sampling + Flow Shift, 10 steps
- VAE Decode: Latent → Final image
🖥️ Performance
Apple MacBook Pro M3 (CPU, 512×512, 10 steps):
| Stage | Time |
|---|---|
| LLM Text Encoding | ~1.5 s |
| VAE Encode | ~3 s |
| DiT Denoise (10 steps) | ~22 s |
| VAE Decode | ~5 s |
| Total | ~32 s |
🧩 Requirements
| Platform | Status | Notes |
|---|---|---|
| macOS (Apple Silicon / Intel) | ✅ Supported | Best performance on M1/M2/M3 |
| Linux (x86_64 / ARM64) | ✅ Supported | Tested on Ubuntu 22.04+ |
| Windows (x86_64) | ⚠️ Experimental | Requires Visual Studio + OpenCV, CI unstable |
- Python: 3.10+
- Compiler: Clang/GCC/MSVC (C++17)
- Tools: git, cmake
❓ FAQ
Q: MNN not found during install?
A: setup.py auto-clones and builds MNN. Just ensure git, cmake, and a C++ compiler are installed.
Q: First run is slow?
A: The model (~1.2GB) is downloaded on first use. Subsequent runs are fast.
Q: GPU support?
A: CPU by default. Use backend="metal" for Metal (macOS), requires MNN built with GPU flags.
Q: Commercial use?
A: Code is Apache-2.0. Model files follow the original publisher's license.
🤝 Contributing
Issues and PRs welcome! See CONTRIBUTING.md.
📜 Changelog
See CHANGELOG.md.
📄 License
Code: Apache-2.0.
Model: MNN-Sana-Edit-V2 belongs to its original publisher.
If this project helps you, please give it a ⭐ Star!
Metadata
Release files for sanana 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sanana-0.1.0.tar.gz | 440.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sanana-0.1.0-cp310-cp310-macosx_11_0_arm64.whl | CPython 3.10 | CPython 3.10 | macOS 11.0+ ARM64 | Details |
Total release size: 971.4 kB
Release files / sanana-0.1.0.tar.gz
| Download URL | sanana-0.1.0.tar.gz |
|---|---|
| Size | 440.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
574a7db9d60b1d27c6ba1bea9c837d5c6d424dc26a1a82483dbcf92c4d1e4470
|
|
BLAKE2b-256 checksum How to use checksums |
e36ee6cc74334124405e03bb56da3d0b09ed02c619f8f7a721280a013257801e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / sanana-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | sanana-0.1.0-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 531.4 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0ae57222b245f7f94a0f538a1d6739d7fd10b468a0d5b148b999f13e36649c6a
|
|
BLAKE2b-256 checksum How to use checksums |
3358e4b8eeecdf4475ac7a771313e9d435767ad8aa2bb3620f38003075c5f46f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for sanana 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.