pyemoji2
Add text and emojis to images with zero dependencies. 🚀✨
A high-performance Python library for rendering text and emojis onto images. Built with Cairo and Pango, bundled for absolute simplicity.
✨ Features
- 🎯 Zero System Dependencies - Everything bundled in the wheel
- 🚀 Native Speed - Written in C, wrapped in Python
- 🎨 Rich Text - Supports all system fonts and emojis
- 🖼️ Direct Memory Access - No Pillow required
- 📦 Cross-Platform - Linux (x86_64, i686), macOS (x86_64, arm64)
- 📱 Android/Termux - Build from source support
- 🔥 Lightweight - ~5-8MB wheels with all dependencies included
🚀 Installation
From PyPI (Recommended)
pip install pyemoji2
That's it! No system libraries, no build tools, no hassle.
From Source (For Development)
If building from source, you need:
Ubuntu/Debian:
sudo apt install libcairo2-dev libpango1.0-dev pkg-config
macOS:
brew install cairo pango pkg-config
Termux (Android):
pkg install python clang make pkg-config libcairo pango
Then install:
pip install .
🖥️ Platform Support
Supported Platforms (Pre-built Wheels)
- ✅ Linux - x86_64, i686 (manylinux2014)
- ✅ macOS - x86_64 (Intel), arm64 (Apple Silicon)
Build from Source
- ✅ Android/Termux - Full support with source build
- ⚠️ Windows - Not currently supported (Cairo/Pango dependency issues)
- ⚠️ Linux ARM64 - Build from source recommended
For unsupported platforms, you can build from source following the instructions above.
📖 Usage
Basic Example
import pyemoji2
# Create a blank canvas
editor = pyemoji2.EmojiEditor.create_empty(500, 300)
# Add text with emojis
editor.add_text("Hello World! 🌍", 50, 150, "Sans", 60, "black")
editor.add_text("Made with ❤️", 150, 250, "Sans", 30, "red")
# Save
editor.save("output.png")
Advanced Example
import pyemoji2
# Create image
editor = pyemoji2.EmojiEditor.create_empty(800, 400)
# Title
editor.add_text("🎉 pyemoji2", 50, 80, "Sans Bold", 72, "black")
# Subtitle
editor.add_text("Zero-dependency emoji rendering", 50, 150, "Sans", 36, "black")
# Features
editor.add_text("✅ Fast", 50, 220, "Sans", 28, "black")
editor.add_text("✅ Simple", 50, 270, "Sans", 28, "black")
editor.add_text("✅ Cross-platform", 50, 320, "Sans", 28, "black")
editor.save("demo.png")
API Reference
EmojiEditor.create_empty(width, height)
Create a blank ARGB32 image.
Parameters:
width(int): Image width in pixelsheight(int): Image height in pixels
Returns: EmojiEditor instance
editor.add_text(text, x, y, font_family, font_size, color)
Add text to the image.
Parameters:
text(str): Text to render (supports emojis)x(float): X coordinate (top-left)y(float): Y coordinate (top-left)font_family(str): Font name (e.g., "Sans", "Serif", "Monospace")font_size(float): Font size in pointscolor(str): Color name ("black", "red", etc.)
editor.save(output_path)
Save the image as PNG.
Parameters:
output_path(str): Output file path
🏗️ Development
Build Extension
python setup.py build_ext --inplace
Run Tests
python test_pyemoji2.py
📊 Performance
- Rendering Speed: ~1ms for typical text
- Memory: Minimal overhead, direct Cairo surfaces
- Wheel Size: 5-10MB (all dependencies included)
🤝 Contributing
Contributions welcome! Please open an issue or PR.
📄 License
MIT
🙏 Acknowledgments
Built with:
- Cairo - 2D graphics library
- Pango - Text layout engine
- cibuildwheel - Cross-platform wheel building
Metadata
Release files for pyemoji2 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyemoji2-0.1.1.tar.gz | 9.1 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyemoji2-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.17+ x86-64 | Details |
| pyemoji2-0.1.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.17+ x86-32 | Details |
| pyemoji2-0.1.1-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details |
Total release size: 9.2 MB
Release files / pyemoji2-0.1.1.tar.gz
| Download URL | pyemoji2-0.1.1.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4460b7d181920c71442754027838e8af7a2ed29cfdd5ae10386383808b7fad9f
|
|
BLAKE2b-256 checksum How to use checksums |
7dc6b3e0038251066a14e15732dab872f13e5c8f09fb68b7bed6f766e6c78059
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pyemoji2-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyemoji2-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
7898ea1eed0e8a2d720a27bd5bd2ec73dc633422a9831e73b1929c3a7f1a375b
|
|
BLAKE2b-256 checksum How to use checksums |
e0b85238d8758274a68ed364cc7a17e6b5f677a86b58a7802ce91a4b32d28c8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pyemoji2-0.1.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | pyemoji2-0.1.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-32 |
|
SHA-256 checksum How to use checksums |
3771887b9dfa1fac91280185cbbc71445190f7bc0b126467a44786c62502952d
|
|
BLAKE2b-256 checksum How to use checksums |
0b61136326554db966677e559177e20b04fca6ff286efb22806a4ee0aa631996
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pyemoji2-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | pyemoji2-0.1.1-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4bada1ef10f204a5524dd7660b7c2f3ed27df360e177747f1ec6773c36ee5c20
|
|
BLAKE2b-256 checksum How to use checksums |
1df08461b0468362fab5f09d4d892a9fd234388e4cdc258f15e4e5a8b89a93aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|