Termux-Diffusion (Python)
Pure CPU Native On-Device Stable Diffusion Runtime for Android Termux & Samsung Galaxy.
Zero PRoot. Zero Virtualization. 100% Native ARM64 Bionic libc & NEON SIMD Vector Acceleration.
Installation & Native Engine Provisioning
# 1. Install Python package from PyPI
pip install termux-diffusion
# 2. Provision prebuilt Pure CPU native engine & OpenMP runtime
termux-diffusion install
Quickstart (Python SDK)
import termux_diffusion as td
# Generate image using pure CPU with LCM anime preset
image_path = td.generate(
prompt="cute polar bear in snow, high quality illustration",
model="anime",
steps=6,
device="cpu",
output_path="polar_bear.png"
)
print(f"Generated and saved to Android Gallery: {image_path}")
CLI Usage
termux-diffusion generate "cute dolphin, vibrant ocean" -m anime --cpu -o dolphin.png
Key Capabilities
- ARMv8.2-A DotProd & FP16 NEON SIMD: Native matrix acceleration compiled directly against Android Bionic libc.
- Built-in VAE Tiling: Reduces peak RAM consumption by ~70% during latent-to-pixel decoding to prevent Out-Of-Memory (OOM) aborts.
- Android MediaStore Auto-Indexing: Automatically synchronizes generated images into
Pictures/TermuxDiffusionand the native Samsung Gallery. - Fail-Fast Protection: Blocks unintended on-device compilation cycles to protect mobile devices from severe thermal throttling.
Hardware Benchmarks (Physical Android Devices)
| Device | AP / Architecture | Wall Time | Sampling Time | Peak RAM |
|---|---|---|---|---|
| Galaxy S25 | Snapdragon 8 Elite | 15m 52s (951s) | 11m 37s (697s) | ~2.5 GB |
| Galaxy S21 | Exynos 2100 | 53m 45s (3221s) | 7m 47s (467s) | ~2.4 GB |
Documentation & Repository
License
Apache-2.0 License. Copyright (c) 2026 Eunho Kim (@uno-km).
Metadata
Release files for termux-diffusion 1.7.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 | |
|---|---|---|---|
| termux_diffusion-1.7.0.tar.gz | 72.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| termux_diffusion-1.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 140.7 kB
Release files / termux_diffusion-1.7.0.tar.gz
| Download URL | termux_diffusion-1.7.0.tar.gz |
|---|---|
| Size | 72.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0aa339b6ca2c7dfbb6ef5a3c88277cc9148b19641449e990f932b7d5ce17a4da
|
|
BLAKE2b-256 checksum How to use checksums |
d3d0eea67ff2ea95b5fb78fc151a4b2cedb7e2f1e624711a1868d9c5da39627a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / termux_diffusion-1.7.0-py3-none-any.whl
| Download URL | termux_diffusion-1.7.0-py3-none-any.whl |
|---|---|
| Size | 68.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a2ca6898fd69fd2c26d9441ea0645fb69da9c4bebe21d1f2e9138b896622b461
|
|
BLAKE2b-256 checksum How to use checksums |
f308b3e22776b82865d019880226674270963503bb7a666eadb384c63fdddb4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|