This Python script applies various film simulation profiles to digital images, allowing you to emulate the look of popular film stocks. It supports both sequential and parallel processing, and allows for custom film profiles through JSON configuration.
- Apply multiple film profiles to a single image
- Adjustable color curves, contrast, saturation, chromatic aberration, and blur
- Film grain simulation
- Color temperature adjustment
- Cross-processing effect
- Optional parallel processing for improved performance
- Custom film profiles via JSON configuration
Original Image | ||
---|---|---|
Fujifilm Velvia 50 | Kodak Portra 400 | Fuji Superia 400 |
---|---|---|
Ilford HP5 Plus 400 | Kodak Ektar 100 | Kodachrome 64 |
---|---|---|
Original Image Source
- Python 3.6+
- Required Python packages:
- numpy
- Pillow
- colour-science
- psutil
- scipy
- piexif
You can install the required packages using pip:
pip install numpy Pillow colour-science psutil scipy piexif
Basic usage:
python film_simulation.py input_image.jpg --profiles film_profiles.json
With parallel processing:
python film_simulation.py input_image.jpg --profiles film_profiles.json --parallel
input_image
: Path to the input image (required)--profiles
: Path to JSON file containing film profiles (required)--chroma
: Override chromatic aberration strength--blur
: Override blur amount--color_temp
: Color temperature (default: 6500K)--cross_process
: Apply cross-processing effect--parallel
: Enable parallel processing
-
Process an image with default settings:
python film_simulation.py my_photo.jpg --profiles default_profiles.json
-
Process an image with parallel processing and custom color temperature:
python film_simulation.py my_photo.jpg --profiles custom_profiles.json --parallel --color_temp 5500
-
Apply cross-processing effect:
python film_simulation.py my_photo.jpg --profiles film_profiles.json --cross_process
You can create custom film profiles by modifying the JSON file. Here's an example structure:
{
"My Custom Film": {
"color_curves": {
"R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.27, 0.53, 0.77, 1]},
"G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.25, 0.5, 0.75, 1]},
"B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.23, 0.47, 0.73, 1]}
},
"contrast": 1.1,
"saturation": 0.9,
"chromatic_aberration": 0.2,
"blur": 0.1,
"base_color": [255, 250, 245],
"grain_amount": 0.03,
"grain_size": 1
}
}
You can include multiple film profiles in a single JSON file.
The script will generate one output image for each film profile in the JSON file. Output images will be saved in the same directory as the input image, with the film profile name appended to the original filename.
Contributions, issues, and feature requests are welcome. Feel free to check issues page if you want to contribute.
[Sinan Onur Altınuç]