# Puhu 🦉
[](https://github.com/bgunebakan/puhu/actions)
[](https://www.python.org/downloads/)
[](https://www.rust-lang.org/)
[](LICENSE)
A **blazingly fast**, modern image processing library for Python, powered by Rust. Puhu provides a Pillow-compatible API while delivering significantly performance for common image operations.
## ✨ Key Features
- **🔥 High Performance**: Significantly fast for common image operations
- **🔄 Pillow Compatible**: Drop-in replacement for most Pillow operations
- **🦀 Rust Powered**: Memory-safe and efficient core written in Rust
- **📦 Easy to Use**: Simple, intuitive API that feels familiar
- **🎯 Format Support**: PNG, JPEG, BMP, TIFF, GIF, WEBP
## 🚀 Quick Start
### Installation
```bash
pip install puhu
```
### Basic Usage
```python
import puhu
# Open an image
img = puhu.open("photo.jpg")
# Resize image
resized = img.resize((800, 600))
# Crop image
cropped = img.crop((100, 100, 500, 400))
# Rotate image
rotated = img.rotate(90)
# Save image
img.save("output.png")
# Create new image
new_img = puhu.new("RGB", (800, 600), "red")
```
### Drop-in Pillow Replacement
```python
# Replace this:
# from PIL import Image
# With this:
from puhu import Image
# Your existing Pillow code works unchanged!
img = Image.open("photo.jpg")
img = img.resize((400, 300))
img.save("resized.jpg")
```
## 🔄 Pillow Compatibility
### ✅ Fully Compatible Operations
- `open()`, `new()`, `save()`
- `resize()`, `crop()`, `rotate()`, `transpose()`
- `copy()`, `thumbnail()`
- Properties: `size`, `width`, `height`, `mode`, `format`
- All major image formats (PNG, JPEG, BMP, TIFF, GIF, WEBP)
### 🚧 Planned Features
- `convert()`, `paste()`, `split()` - _High Priority_
- `filter()`, `getpixel()`, `putpixel()` - _Medium Priority_
- `fromarray()`, `frombytes()` - _NumPy Integration_
## 📖 API Reference
### Core Functions
```python
# Open image from file or bytes
img = puhu.open("path/to/image.jpg")
img = puhu.open(image_bytes)
# Create new image
img = puhu.new(mode, size, color=None)
# Examples:
img = puhu.new("RGB", (800, 600)) # Black image
img = puhu.new("RGB", (800, 600), "red") # Red image
img = puhu.new("RGB", (800, 600), (255, 0, 0)) # Red image with RGB tuple
```
### Image Operations
```python
# Resize image
resized = img.resize((width, height), resample=puhu.Resampling.BILINEAR)
# Crop image (left, top, right, bottom)
cropped = img.crop((x1, y1, x2, y2))
# Rotate image (90°, 180°, 270° supported)
rotated = img.rotate(90)
# Transpose/flip image
flipped = img.transpose(puhu.Transpose.FLIP_LEFT_RIGHT)
flipped = img.transpose(puhu.Transpose.FLIP_TOP_BOTTOM)
# Copy image
copy = img.copy()
# Create thumbnail (modifies image in-place)
img.thumbnail((200, 200))
# Save image
img.save("output.jpg", format="JPEG")
img.save("output.png") # Format auto-detected from extension
```
### Properties
```python
# Image dimensions
width = img.width
height = img.height
size = img.size # (width, height) tuple
# Image mode and format
mode = img.mode # "RGB", "RGBA", "L", etc.
format = img.format # "JPEG", "PNG", etc.
# Raw pixel data
bytes_data = img.to_bytes()
```
## 🔧 Development
### Building from Source
```bash
# Clone repository
git clone https://github.com/your-username/puhu.git
cd puhu
# Install dependencies
pip install -r requirements.txt
# Build Rust extension
maturin develop --release
# Run tests
pytest python/puhu/tests/
```
### Requirements
- Python 3.8+
- Rust 1.70+
- Maturin for building
## 🤝 Contributing
Contributions are welcome! Areas where help is needed:
1. **High Priority Features**: `convert()`, `paste()`, `fromarray()`, `split()`
2. **Performance Optimization**: Further speed improvements
3. **Format Support**: Additional image formats
4. **Documentation**: Examples and tutorials
5. **Testing**: Edge cases and compatibility tests
## 📄 License
MIT License - see [LICENSE](LICENSE) file for details.
## 🙏 Acknowledgments
- Built with [PyO3](https://pyo3.rs/) for Python-Rust integration
- Uses [image-rs](https://github.com/image-rs/image) for core image processing
- Inspired by [Pillow](https://pillow.readthedocs.io/) for API design
Raw data
{
"_id": null,
"home_page": null,
"name": "puhu",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "image, processing, pillow, rust, performance",
"author": null,
"author_email": "Bilal Tonga <bilaltonga@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/9a/cd/495fae5d602256a1f694b42148c3fd3a25ffe7b88d11ffe1b9337822c723/puhu-0.1.0.tar.gz",
"platform": null,
"description": "# Puhu \ud83e\udd89\n\n[](https://github.com/bgunebakan/puhu/actions)\n[](https://www.python.org/downloads/)\n[](https://www.rust-lang.org/)\n[](LICENSE)\n\nA **blazingly fast**, modern image processing library for Python, powered by Rust. Puhu provides a Pillow-compatible API while delivering significantly performance for common image operations.\n\n## \u2728 Key Features\n\n- **\ud83d\udd25 High Performance**: Significantly fast for common image operations\n- **\ud83d\udd04 Pillow Compatible**: Drop-in replacement for most Pillow operations\n- **\ud83e\udd80 Rust Powered**: Memory-safe and efficient core written in Rust\n- **\ud83d\udce6 Easy to Use**: Simple, intuitive API that feels familiar\n- **\ud83c\udfaf Format Support**: PNG, JPEG, BMP, TIFF, GIF, WEBP\n\n## \ud83d\ude80 Quick Start\n\n### Installation\n\n```bash\npip install puhu\n```\n\n### Basic Usage\n\n```python\nimport puhu\n\n# Open an image\nimg = puhu.open(\"photo.jpg\")\n\n# Resize image\nresized = img.resize((800, 600))\n\n# Crop image\ncropped = img.crop((100, 100, 500, 400))\n\n# Rotate image\nrotated = img.rotate(90)\n\n# Save image\nimg.save(\"output.png\")\n\n# Create new image\nnew_img = puhu.new(\"RGB\", (800, 600), \"red\")\n```\n\n### Drop-in Pillow Replacement\n\n```python\n# Replace this:\n# from PIL import Image\n\n# With this:\nfrom puhu import Image\n\n# Your existing Pillow code works unchanged!\nimg = Image.open(\"photo.jpg\")\nimg = img.resize((400, 300))\nimg.save(\"resized.jpg\")\n```\n\n## \ud83d\udd04 Pillow Compatibility\n\n### \u2705 Fully Compatible Operations\n\n- `open()`, `new()`, `save()`\n- `resize()`, `crop()`, `rotate()`, `transpose()`\n- `copy()`, `thumbnail()`\n- Properties: `size`, `width`, `height`, `mode`, `format`\n- All major image formats (PNG, JPEG, BMP, TIFF, GIF, WEBP)\n\n### \ud83d\udea7 Planned Features\n\n- `convert()`, `paste()`, `split()` - _High Priority_\n- `filter()`, `getpixel()`, `putpixel()` - _Medium Priority_\n- `fromarray()`, `frombytes()` - _NumPy Integration_\n\n## \ud83d\udcd6 API Reference\n\n### Core Functions\n\n```python\n# Open image from file or bytes\nimg = puhu.open(\"path/to/image.jpg\")\nimg = puhu.open(image_bytes)\n\n# Create new image\nimg = puhu.new(mode, size, color=None)\n# Examples:\nimg = puhu.new(\"RGB\", (800, 600)) # Black image\nimg = puhu.new(\"RGB\", (800, 600), \"red\") # Red image\nimg = puhu.new(\"RGB\", (800, 600), (255, 0, 0)) # Red image with RGB tuple\n```\n\n### Image Operations\n\n```python\n# Resize image\nresized = img.resize((width, height), resample=puhu.Resampling.BILINEAR)\n\n# Crop image (left, top, right, bottom)\ncropped = img.crop((x1, y1, x2, y2))\n\n# Rotate image (90\u00b0, 180\u00b0, 270\u00b0 supported)\nrotated = img.rotate(90)\n\n# Transpose/flip image\nflipped = img.transpose(puhu.Transpose.FLIP_LEFT_RIGHT)\nflipped = img.transpose(puhu.Transpose.FLIP_TOP_BOTTOM)\n\n# Copy image\ncopy = img.copy()\n\n# Create thumbnail (modifies image in-place)\nimg.thumbnail((200, 200))\n\n# Save image\nimg.save(\"output.jpg\", format=\"JPEG\")\nimg.save(\"output.png\") # Format auto-detected from extension\n```\n\n### Properties\n\n```python\n# Image dimensions\nwidth = img.width\nheight = img.height\nsize = img.size # (width, height) tuple\n\n# Image mode and format\nmode = img.mode # \"RGB\", \"RGBA\", \"L\", etc.\nformat = img.format # \"JPEG\", \"PNG\", etc.\n\n# Raw pixel data\nbytes_data = img.to_bytes()\n```\n\n## \ud83d\udd27 Development\n\n### Building from Source\n\n```bash\n# Clone repository\ngit clone https://github.com/your-username/puhu.git\ncd puhu\n\n# Install dependencies\npip install -r requirements.txt\n\n# Build Rust extension\nmaturin develop --release\n\n# Run tests\npytest python/puhu/tests/\n\n```\n\n### Requirements\n\n- Python 3.8+\n- Rust 1.70+\n- Maturin for building\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome! Areas where help is needed:\n\n1. **High Priority Features**: `convert()`, `paste()`, `fromarray()`, `split()`\n2. **Performance Optimization**: Further speed improvements\n3. **Format Support**: Additional image formats\n4. **Documentation**: Examples and tutorials\n5. **Testing**: Edge cases and compatibility tests\n\n## \ud83d\udcc4 License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## \ud83d\ude4f Acknowledgments\n\n- Built with [PyO3](https://pyo3.rs/) for Python-Rust integration\n- Uses [image-rs](https://github.com/image-rs/image) for core image processing\n- Inspired by [Pillow](https://pillow.readthedocs.io/) for API design\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A modern, high-performance image processing library for Python, powered by Rust.",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://bgunebakan.github.io/puhu",
"Homepage": "https://github.com/bgunebakan/puhu",
"Issues": "https://github.com/bgunebakan/puhu/issues",
"Repository": "https://github.com/bgunebakan/puhu"
},
"split_keywords": [
"image",
" processing",
" pillow",
" rust",
" performance"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a4e3862a4d689df481428ef572aa56ec763923a75070604fb7ba6e9580c1ef1b",
"md5": "827a0f720e5113174c75e5119fae1737",
"sha256": "982b55539c63daccb3b90a877afc893510d7f8d36f6ebd7c7e57097ddaf6c3b7"
},
"downloads": -1,
"filename": "puhu-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "827a0f720e5113174c75e5119fae1737",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8",
"size": 840334,
"upload_time": "2025-08-20T22:29:37",
"upload_time_iso_8601": "2025-08-20T22:29:37.152038Z",
"url": "https://files.pythonhosted.org/packages/a4/e3/862a4d689df481428ef572aa56ec763923a75070604fb7ba6e9580c1ef1b/puhu-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9acd495fae5d602256a1f694b42148c3fd3a25ffe7b88d11ffe1b9337822c723",
"md5": "1c6d93ef8e247b5578493a07a548dfc0",
"sha256": "fc1bfd389eb0958065b1b6884c06921fa0e593d0fb7edb419af70573d95a48ac"
},
"downloads": -1,
"filename": "puhu-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "1c6d93ef8e247b5578493a07a548dfc0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 46948,
"upload_time": "2025-08-20T22:29:39",
"upload_time_iso_8601": "2025-08-20T22:29:39.011140Z",
"url": "https://files.pythonhosted.org/packages/9a/cd/495fae5d602256a1f694b42148c3fd3a25ffe7b88d11ffe1b9337822c723/puhu-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-20 22:29:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bgunebakan",
"github_project": "puhu",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pytest",
"specs": [
[
"==",
"8.3.5"
]
]
},
{
"name": "maturin",
"specs": [
[
"==",
"1.9.3"
]
]
}
],
"lcname": "puhu"
}