PhotoFF Installation Guide (Linux & Windows)
Prerequisites
Before installing PhotoFF, ensure you have the following prerequisites:
- Python 3.9 or newer
- NVIDIA GPU with CUDA support
- CUDA Toolkit 11.0 or newer – Required for compiling the CUDA components
- CFFI – Used for interfacing between Python and the CUDA library
- Pillow – Used for image loading, saving, and text rendering
Python Dependencies
Install the required Python packages:
Installing CUDA Toolkit
- Download the CUDA Toolkit from the NVIDIA Developer website
- Follow the instructions for your OS (Linux or Windows)
- Ensure
nvcc
is accessible:
Compiling the CUDA Library
🐧 For Linux:
-
Clone the repository:
-
Compile the
.so
shared object: -
You’ll get
photoff.so
. -
Make it available to your system:
Add to ~/.bashrc
or ~/.zshrc
:
/your/path/photoff
with the actual path where photoff.so
is located. Then run: or 🪟 For Windows:
-
Clone the repository:
-
Compile the
.dll
using: -
Add the folder containing
photoff.dll
to your system PATH: - Search for “Environment Variables” in the Start menu
- Edit the PATH variable, and add the folder path
- Restart your terminal or IDE
Installing the Python Package
Run this in the root of the project (after compilation):
Verifying the Installation
Test your installation with the following Python script:
from photoff.operations.fill import fill_color
from photoff.io import save_image
from photoff.core.types import CudaImage, RGBA
# Create a 200x200 red square
img = CudaImage(200, 200)
fill_color(img, RGBA(255, 0, 0, 255))
save_image(img, "red_square.png")
img.free()
print("Installation successful!")
If you see the image red_square.png
and the message “Installation successful!”, your setup is working.
Notes
- CFFI will load the appropriate file based on your OS
License
PhotoFF is distributed under the MIT license.