2.1 KiB
2.1 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Chrome is a high-performance C++17 port of negfix8, a tool for processing scanned color negative film. It inverts and color-corrects 16-bit linear Rec.709 TIFF images from film scanners.
Build Commands
# Configure and build
cmake -B build/ -S .
cd build && make
# The executable is built at build/chrome
Dependencies: OpenCV (core, imgproc, imgcodecs), OpenMP (optional, for parallelization)
Testing
Manual testing only. Compare output against reference files in test_data/:
test_data/test_input.tiff- Sample input scantest_data/test_expected.tiff- Reference output from original negfix8test_data/current_output.tiff- Current implementation output
./build/chrome -i test_data/test_input.tiff -o test_data/current_output.tiff
# Then visually compare or diff against test_data/test_expected.tiff
Usage
./chrome -i input.tif [-o output.tif] [flags]
Flags:
-g <val> Set gamma (default 2.15)
-cs Enable contrast stretching
-sat Enable saturation boost (+20%)
-m Mirror image horizontally
-r <N> Binning (scale down by 1/N)
-c <file> Create profile and save to file (exits after)
-u <file> Use existing profile
Architecture
Single-file implementation in main.cpp with this pipeline:
- Settings/Profile structs - CLI options and image analysis data
- Image analysis (
analyzeImage) - Finds min/max per channel after shave+blur preprocessing - Profile save/load - Stores derived gamma corrections and offset values
- LUT generation (
generateLUTs) - Creates 65536-entry lookup tables for each channel using OpenMP - Pixel processing - Applies LUTs in parallel via OpenMP
- Post-processing - Optional saturation boost, contrast stretch, mirror
- Output - Writes LZW-compressed TIFF
The core algorithm inverts negative film by dividing film base values by pixel values, applies per-channel gamma correction to neutralize orange mask, then applies global gamma.