sinanonur commited on
Commit
c77b274
·
1 Parent(s): abdf2c6

film-simulation initial version

Browse files
Files changed (2) hide show
  1. 12-film-profiles.json +170 -0
  2. README.md +113 -2
12-film-profiles.json ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Kodak Portra 400": {
3
+ "color_curves": {
4
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.27, 0.53, 0.77, 1]},
5
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.25, 0.5, 0.75, 1]},
6
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.23, 0.47, 0.73, 1]}
7
+ },
8
+ "contrast": 1.1,
9
+ "saturation": 0.9,
10
+ "chromatic_aberration": 0.2,
11
+ "blur": 0.1,
12
+ "base_color": [255, 250, 245],
13
+ "grain_amount": 0.03,
14
+ "grain_size": 1
15
+ },
16
+ "Fuji Superia 400": {
17
+ "color_curves": {
18
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.28, 0.55, 0.78, 1]},
19
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.26, 0.52, 0.76, 1]},
20
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.24, 0.49, 0.74, 1]}
21
+ },
22
+ "contrast": 1.2,
23
+ "saturation": 1.1,
24
+ "chromatic_aberration": 0.3,
25
+ "blur": 0.2,
26
+ "base_color": [250, 255, 255],
27
+ "grain_amount": 0.04,
28
+ "grain_size": 2
29
+ },
30
+ "Kodak Ektar 100": {
31
+ "color_curves": {
32
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.3, 0.6, 0.85, 1]},
33
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.25, 0.5, 0.75, 1]},
34
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.2, 0.4, 0.65, 1]}
35
+ },
36
+ "contrast": 1.3,
37
+ "saturation": 1.2,
38
+ "chromatic_aberration": 0.1,
39
+ "blur": 0.05,
40
+ "base_color": [255, 253, 248],
41
+ "grain_amount": 0.02,
42
+ "grain_size": 1
43
+ },
44
+ "Fuji Velvia 50": {
45
+ "color_curves": {
46
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.3, 0.65, 0.9, 1]},
47
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.25, 0.55, 0.8, 1]},
48
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.2, 0.45, 0.7, 1]}
49
+ },
50
+ "contrast": 1.4,
51
+ "saturation": 1.5,
52
+ "chromatic_aberration": 0.15,
53
+ "blur": 0.05,
54
+ "base_color": [255, 250, 250],
55
+ "grain_amount": 0.01,
56
+ "grain_size": 1
57
+ },
58
+ "Ilford HP5 Plus": {
59
+ "color_curves": {
60
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.23, 0.47, 0.73, 1]},
61
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.23, 0.47, 0.73, 1]},
62
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.23, 0.47, 0.73, 1]}
63
+ },
64
+ "contrast": 1.2,
65
+ "saturation": 0,
66
+ "chromatic_aberration": 0.2,
67
+ "blur": 0.1,
68
+ "base_color": [255, 255, 255],
69
+ "grain_amount": 0.05,
70
+ "grain_size": 2
71
+ },
72
+ "Kodak Tri-X 400": {
73
+ "color_curves": {
74
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.22, 0.45, 0.7, 1]},
75
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.22, 0.45, 0.7, 1]},
76
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.22, 0.45, 0.7, 1]}
77
+ },
78
+ "contrast": 1.3,
79
+ "saturation": 0,
80
+ "chromatic_aberration": 0.25,
81
+ "blur": 0.15,
82
+ "base_color": [255, 255, 255],
83
+ "grain_amount": 0.06,
84
+ "grain_size": 3
85
+ },
86
+ "Fuji Pro 400H": {
87
+ "color_curves": {
88
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.26, 0.52, 0.76, 1]},
89
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.25, 0.5, 0.75, 1]},
90
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.24, 0.48, 0.74, 1]}
91
+ },
92
+ "contrast": 1.1,
93
+ "saturation": 0.95,
94
+ "chromatic_aberration": 0.2,
95
+ "blur": 0.1,
96
+ "base_color": [252, 255, 255],
97
+ "grain_amount": 0.035,
98
+ "grain_size": 2
99
+ },
100
+ "Kodak Gold 200": {
101
+ "color_curves": {
102
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.28, 0.56, 0.8, 1]},
103
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.26, 0.52, 0.76, 1]},
104
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.24, 0.48, 0.72, 1]}
105
+ },
106
+ "contrast": 1.2,
107
+ "saturation": 1.1,
108
+ "chromatic_aberration": 0.3,
109
+ "blur": 0.15,
110
+ "base_color": [255, 248, 240],
111
+ "grain_amount": 0.04,
112
+ "grain_size": 2
113
+ },
114
+ "Fuji Provia 100F": {
115
+ "color_curves": {
116
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.26, 0.52, 0.77, 1]},
117
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.25, 0.5, 0.75, 1]},
118
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.24, 0.48, 0.73, 1]}
119
+ },
120
+ "contrast": 1.2,
121
+ "saturation": 1.1,
122
+ "chromatic_aberration": 0.1,
123
+ "blur": 0.05,
124
+ "base_color": [253, 255, 255],
125
+ "grain_amount": 0.02,
126
+ "grain_size": 1
127
+ },
128
+ "Kodak Ektachrome E100": {
129
+ "color_curves": {
130
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.27, 0.54, 0.79, 1]},
131
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.26, 0.52, 0.77, 1]},
132
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.25, 0.5, 0.75, 1]}
133
+ },
134
+ "contrast": 1.25,
135
+ "saturation": 1.15,
136
+ "chromatic_aberration": 0.15,
137
+ "blur": 0.075,
138
+ "base_color": [254, 255, 255],
139
+ "grain_amount": 0.025,
140
+ "grain_size": 1
141
+ },
142
+ "Lomography Color Negative 400": {
143
+ "color_curves": {
144
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.3, 0.6, 0.85, 1]},
145
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.28, 0.56, 0.8, 1]},
146
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.26, 0.52, 0.75, 1]}
147
+ },
148
+ "contrast": 1.3,
149
+ "saturation": 1.2,
150
+ "chromatic_aberration": 0.4,
151
+ "blur": 0.2,
152
+ "base_color": [255, 245, 240],
153
+ "grain_amount": 0.06,
154
+ "grain_size": 3
155
+ },
156
+ "CineStill 800T": {
157
+ "color_curves": {
158
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.24, 0.48, 0.74, 1]},
159
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.26, 0.52, 0.76, 1]},
160
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.28, 0.56, 0.8, 1]}
161
+ },
162
+ "contrast": 1.1,
163
+ "saturation": 0.95,
164
+ "chromatic_aberration": 0.3,
165
+ "blur": 0.15,
166
+ "base_color": [240, 250, 255],
167
+ "grain_amount": 0.05,
168
+ "grain_size": 2
169
+ }
170
+ }
README.md CHANGED
@@ -1,2 +1,113 @@
1
- # film-simulation
2
- Provides a basic film simulation for retro look in your photos
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Film Simulation Script
2
+
3
+ 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.
4
+
5
+ ## Features
6
+
7
+ - Apply multiple film profiles to a single image
8
+ - Adjustable color curves, contrast, saturation, chromatic aberration, and blur
9
+ - Film grain simulation
10
+ - Color temperature adjustment
11
+ - Cross-processing effect
12
+ - Optional parallel processing for improved performance
13
+ - Custom film profiles via JSON configuration
14
+
15
+ ## Requirements
16
+
17
+ - Python 3.6+
18
+ - Required Python packages:
19
+ - numpy
20
+ - Pillow
21
+ - colour-science
22
+ - psutil
23
+ - scipy
24
+ - piexif
25
+
26
+ You can install the required packages using pip:
27
+
28
+ ```
29
+ pip install numpy Pillow colour-science psutil scipy piexif
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ Basic usage:
35
+
36
+ ```
37
+ python film_simulation.py input_image.jpg --profiles film_profiles.json
38
+ ```
39
+
40
+ With parallel processing:
41
+
42
+ ```
43
+ python film_simulation.py input_image.jpg --profiles film_profiles.json --parallel
44
+ ```
45
+
46
+ ### Command-line Arguments
47
+
48
+ - `input_image`: Path to the input image (required)
49
+ - `--profiles`: Path to JSON file containing film profiles (required)
50
+ - `--chroma`: Override chromatic aberration strength
51
+ - `--blur`: Override blur amount
52
+ - `--color_temp`: Color temperature (default: 6500K)
53
+ - `--cross_process`: Apply cross-processing effect
54
+ - `--parallel`: Enable parallel processing
55
+
56
+ ### Examples
57
+
58
+ 1. Process an image with default settings:
59
+ ```
60
+ python film_simulation.py my_photo.jpg --profiles default_profiles.json
61
+ ```
62
+
63
+ 2. Process an image with parallel processing and custom color temperature:
64
+ ```
65
+ python film_simulation.py my_photo.jpg --profiles custom_profiles.json --parallel --color_temp 5500
66
+ ```
67
+
68
+ 3. Apply cross-processing effect:
69
+ ```
70
+ python film_simulation.py my_photo.jpg --profiles film_profiles.json --cross_process
71
+ ```
72
+
73
+ ## Custom Film Profiles
74
+
75
+ You can create custom film profiles by modifying the JSON file. Here's an example structure:
76
+
77
+ ```json
78
+ {
79
+ "My Custom Film": {
80
+ "color_curves": {
81
+ "R": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.27, 0.53, 0.77, 1]},
82
+ "G": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.25, 0.5, 0.75, 1]},
83
+ "B": {"x": [0, 0.25, 0.5, 0.75, 1], "y": [0, 0.23, 0.47, 0.73, 1]}
84
+ },
85
+ "contrast": 1.1,
86
+ "saturation": 0.9,
87
+ "chromatic_aberration": 0.2,
88
+ "blur": 0.1,
89
+ "base_color": [255, 250, 245],
90
+ "grain_amount": 0.03,
91
+ "grain_size": 1
92
+ }
93
+ }
94
+ ```
95
+
96
+ You can include multiple film profiles in a single JSON file.
97
+
98
+ ## Output
99
+
100
+ 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.
101
+
102
+ ## License
103
+
104
+ [MIT License](https://opensource.org/licenses/MIT)
105
+
106
+ ## Contributing
107
+
108
+ Contributions, issues, and feature requests are welcome. Feel free to check [issues page](https://github.com/yourusername/film-simulation/issues) if you want to contribute.
109
+
110
+ ## Author
111
+
112
+ [Sinan Onur Altınuç]
113
+