155 lines
4.0 KiB
Markdown
155 lines
4.0 KiB
Markdown
# Chrome
|
||
|
||
A high-performance C++ port of [negfix8](https://github.com/chrishunt/negfix8) for processing scanned color negative film. Inverts and color-corrects 16-bit linear Rec.709 TIFF images from film scanners.
|
||
|
||
## Example
|
||
|
||
<table>
|
||
<tr>
|
||
<td align="center"><strong>Input (Scanned Negative)</strong></td>
|
||
<td align="center"></td>
|
||
<td align="center"><strong>Output (Processed)</strong></td>
|
||
</tr>
|
||
<tr>
|
||
<td><img src="test_data/test_input.jpeg" width="400" alt="Scanned negative"></td>
|
||
<td align="center">➜<br><code>chrome -cs -sat 50 -exp 1.2</code><br>➜</td>
|
||
<td><img src="test_data/current_output_adj.jpeg" width="400" alt="Processed output"></td>
|
||
</tr>
|
||
</table>
|
||
|
||
## Performance
|
||
|
||
### Chrome vs negfix8
|
||
|
||
| Image | Tool | Flags | Time | Speedup |
|
||
|-------|------|-------|------|---------|
|
||
| Large (9098×12160, 633MB) | negfix8 | — | 18m 8s | 1x |
|
||
| Large (9098×12160, 633MB) | **Chrome** | — | **1.26s** | **~865x** |
|
||
| Small (4272×6272, 153MB) | negfix8 | — | 22.0s | 1x |
|
||
| Small (4272×6272, 153MB) | **Chrome** | — | **0.41s** | **~54x** |
|
||
|
||
### Chrome Detailed Benchmarks
|
||
|
||
#### Large Image (test_input.tiff — 9098×12160, 633MB)
|
||
|
||
| Flags | Time |
|
||
|-------|------|
|
||
| *(baseline)* | 1.26s |
|
||
| `-cs` | 1.38s |
|
||
| `-sat 50` | 1.38s |
|
||
| `-exp 1.2` | 1.39s |
|
||
| `-cs -sat 50 -exp 1.2` | 1.45s |
|
||
|
||
#### Small Image (test_input_small.tiff — 4272×6272, 153MB)
|
||
|
||
| Flags | Time |
|
||
|-------|------|
|
||
| *(baseline)* | 0.41s |
|
||
| `-cs` | 0.36s |
|
||
| `-sat 50` | 0.35s |
|
||
| `-exp 1.2` | 0.35s |
|
||
| `-cs -sat 50 -exp 1.2` | 0.36s |
|
||
|
||
*Benchmarks run on AMD Ryzen 9 7950X3D (32 threads, 64GB RAM)*
|
||
|
||
## Features
|
||
|
||
- LUT-based pixel processing with OpenMP parallelization
|
||
- Per-channel gamma correction to neutralize orange mask
|
||
- Profile save/load for consistent batch processing
|
||
- Optional saturation boost, contrast stretching, exposure adjustment, mirror
|
||
|
||
## Building
|
||
|
||
### Dependencies
|
||
|
||
- CMake 3.x+
|
||
- OpenCV (core, imgproc, imgcodecs)
|
||
- OpenMP (optional, for parallelization)
|
||
|
||
#### Ubuntu/Debian
|
||
|
||
```bash
|
||
sudo apt install cmake libopencv-dev
|
||
```
|
||
|
||
#### macOS (Homebrew)
|
||
|
||
```bash
|
||
brew install cmake opencv libomp
|
||
```
|
||
|
||
### Build
|
||
|
||
```bash
|
||
cmake -B build -S .
|
||
cmake --build build
|
||
```
|
||
|
||
The executable is built at `build/chrome`.
|
||
|
||
## Usage
|
||
|
||
```bash
|
||
./build/chrome -i input.tif [-o output.tif] [flags]
|
||
```
|
||
|
||
### Flags
|
||
|
||
| Flag | Description |
|
||
|------|-------------|
|
||
| `-g <val>` | Set gamma (default 2.15) |
|
||
| `-cs` | Enable contrast stretching |
|
||
| `-exp <N>` | Exposure adjustment in stops (-10 to +10) |
|
||
| `-sat [N]` | Saturation boost, N=0-100 (default 20 if no value) |
|
||
| `-m` | Mirror image horizontally |
|
||
| `-r <N>` | Binning/downscale by factor N |
|
||
| `-c <file>` | Create profile from image and save (exits after) |
|
||
| `-u <file>` | Use existing profile for processing |
|
||
|
||
### Examples
|
||
|
||
```bash
|
||
# Basic conversion
|
||
./build/chrome -i scan.tiff -o output.tiff
|
||
|
||
# With adjustments (contrast stretch, 50% saturation boost, +1.2 stops exposure)
|
||
./build/chrome -i scan.tiff -o output.tiff -cs -sat 50 -exp 1.2
|
||
|
||
# Create a profile for batch processing
|
||
./build/chrome -i scan.tiff -c myfilm.profile
|
||
|
||
# Apply saved profile to multiple images
|
||
./build/chrome -i scan2.tiff -o output2.tiff -u myfilm.profile
|
||
```
|
||
|
||
## Testing
|
||
|
||
Test files are located in `test_data/`:
|
||
|
||
| File | Description |
|
||
|------|-------------|
|
||
| `test_input.tiff` | Sample 16-bit scanned negative |
|
||
| `test_expected.tiff` | Reference output from original negfix8 |
|
||
| `current_output.tiff` | Chrome output (default settings) |
|
||
| `current_output_adj.tiff` | Chrome output with `-cs -sat 50 -exp 1.2` |
|
||
|
||
```bash
|
||
# Basic conversion
|
||
./build/chrome -i test_data/test_input.tiff -o test_data/current_output.tiff
|
||
|
||
# With adjustments (as shown in example above)
|
||
./build/chrome -i test_data/test_input.tiff -o test_data/current_output_adj.tiff -cs -sat 50 -exp 1.2
|
||
```
|
||
|
||
## Credits
|
||
|
||
- Original [negfix8](https://github.com/chrishunt/negfix8) by Chris Hunt
|
||
- Original negfix algorithm created by JaZ99
|
||
|
||
## License
|
||
|
||
Copyright 2025 DWS (Dubey Web Services, DWS LLC)
|
||
|
||
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
|