https://github.com/offerrall/photoff
https://github.com/offerrall/photoff
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/offerrall/photoff
- Owner: offerrall
- Created: 2025-02-21T08:45:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-28T11:35:42.000Z (over 1 year ago)
- Last Synced: 2025-02-28T15:38:04.543Z (over 1 year ago)
- Language: Python
- Size: 11.1 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# PhotoFF
**PhotoFF** is a high-performance GPU image processing library written in Python and accelerated with CUDA.
Originally developed as part of a custom OBS-style rendering engine, it has evolved into a personal tool that I intend to use and maintain for the foreseeable future.
I'm sharing this project because it might be beneficial to others, and I highly value real-world feedback. Please note that this is not a commercial product but a project I am passionate about.
---
## โก Key Features
- **CUDA Acceleration:** Experience real-time filters, blending, resizing, and more, all powered by your GPU.
- **Smart Memory Management:** Allocate memory once and reuse it efficiently with dynamic size adjustments.
- **Simple and Direct Python API:** Enjoy a user-friendly API similar to PIL, but supercharged for GPU processing.
- **Exceptional Performance:** [Benchmarks](https://offerrall.github.io/photoff/benchmarks/)
- **Comprehensive Documentation:** Benefit from clear explanations and practical examples.
- **Minimal Dependencies:** Requires only `pillow`, `cffi`.
---
## ๐ง Why PhotoFF Exists
My motivation for creating PhotoFF stemmed from a need for a solution beyond the capabilities of existing libraries like PIL for tasks such as:
- Real-time scene composition.
- Generating GPU-accelerated overlays with visual effects.
- Batch image processing (creating thumbnails, banners, and collages).
- Developing fluid visual interfaces with dynamic filters.
- Building automation tools for creators, streamers, VTubers, and dashboards.
---
## ๐ฆ Installation
### Prerequisites
- NVIDIA GPU with CUDA support
- CUDA Toolkit 11.0+
- Python packages: `cffi`, `pillow`,
### Installation
For detailed setup and compilation instructions, please refer to the [Installation Guide](https://offerrall.github.io/photoff/installation/).
---
## ๐งช Quick Example
```python
from photoff.operations.filters import apply_gaussian_blur, apply_corner_radius
from photoff.io import save_image, load_image
from photoff import CudaImage
# Load image to GPU memory
src_image = load_image("./assets/stock.jpg")
# Apply filters
apply_gaussian_blur(src_image, radius=5.0)
apply_corner_radius(src_image, size=200)
# Save result
save_image(src_image, "./assets/gaussian_blur_test.png")
# Free GPU memory
src_image.free()
```
---
## ๐ Buffer Reuse in Action
```python
# Allocate a single large buffer
shared_buffer = CudaImage(5000, 5000)
# Reuse it for different sizes
shared_buffer.width, shared_buffer.height = 800, 600
resize(image1, 800, 600, resize_image_cache=shared_buffer)
shared_buffer.width, shared_buffer.height = 1280, 720
resize(image2, 1280, 720, resize_image_cache=shared_buffer)
# No reallocs, no fragmentation, max performance
```
## ๐ Documentation
Explore the full documentation at [https://offerrall.github.io/photoff/](https://offerrall.github.io/photoff/):
- [๐ฐ Basics](https://offerrall.github.io/photoff/basics/)
- [โ๏ธ Advanced Techniques](https://offerrall.github.io/photoff/advanced/)
- [๐ฌ API Reference](https://offerrall.github.io/photoff/api/)
## ๐ค Contributing
Contributions are welcome! While this is a personal project, I intend to continue its development and improvement. If you're interested in contributing, please feel free to jump in.
---
## ๐ License
MIT.