Repository navigation
Releases
OpenFilmKit 0.6.0
Cleanup on other machines: one at a time over SSH, or from a queue several machines work from. Stopped work picks up where it left off, with the same result.
Stopping and resuming
clean now saves each slow stage as it finishes: the faces, crop and date stamp; the dust mask; the scratch model's results; the scratch mask; and every window MI-GAN fills. If a run is stopped (Ctrl-C, a machine that sleeps, a power cut), running the same command again picks up from there. The result is the same as an uninterrupted run, byte for byte. On a 1.3 MP portrait stopped after 2 of 12 windows, the rest took 5 s instead of 48. Saved stages live in ~/.cache/openfilmkit/checkpoints and are cleared once the photo is done.
clean --on HOST
Cleans on another machine over SSH and brings the results back beside the originals. The host needs the same OpenFilmKit, rsync and an SSH key. Run the same command again after a dropped connection: finished photos are only copied back, and one under way resumes on the host. ~/.config/openfilmkit/hosts.toml can say where openfilmkit lives on a host. Cleaned on a Raspberry Pi 5, a portrait came back identical to the same clean on a Mac.
A queue and workers
clean --queue NAME puts photos into a queue: a folder on any machine reachable over SSH. Nothing runs there. openfilmkit worker (a systemd service is in packaging/) takes jobs one at a time:
- Choosing: the oldest job it can do. That means the same OpenFilmKit code, a memory need it can meet, inside its working hours, and never while a service named in
yield_tois busy (another program sharing the machine). - Claims: a worker renews its claim every 2 minutes. A claim not renewed for 10 minutes lapses, and the next worker continues from the slow stages the last one pushed.
- Access: workers only use
rsync, read the queue and write their own folder, so each can have an SSH key restricted withrrsync.
queue status shows jobs and workers. queue collect checks every result against its recipe before putting it beside the original, and runs a job again if its result doesn't check out.
Claims keep workers out of each other's way but can't rule out two doing the same job. That's harmless: a job gives the same file wherever it runs, and collecting keeps the first good one.
Job packages
All of this is built on job packages: clean --pack DIR, then openfilmkit job run, job show, job collect and job remove. A package holds one photo and its options. It's named by a checksum of everything that decides the result, including a fingerprint of the OpenFilmKit code (openfilmkit job build). So the same work packs to the same package, and runs only where the code is the same. The same photo in two folders is one job, and both folders get the result.
Install or upgrade
brew upgrade aidansiegel/openfilmkit/openfilmkitOpenFilmKit 0.5.0
Cleanup that leaves more of the photo alone, fits in 2.5 GB, and takes spots you point at.
Less over-cleaning
- Hair: the dust pass no longer takes glints in hair for dust. A speck counts only if the fine detail around it is no stronger than a few times the photo's own grain, so dust on skin, walls and sky still goes. On Sally Ride's 1984 NASA portrait the old pass filled 42 hair glints. With
--scratches, the face rules now apply to skin only, not to hair, collars or hats. - Date stamps, bright: the orange-stamp rule now takes only a short line of digits in a corner. Before, it could protect a Navy portrait's gold insignia, ribbons and buttons from dust removal.
- Date stamps, faint: stamps printed faintly over the picture, common on negative conversions, are now found by their seven-segment digits, upright or running down the side of a sideways print. Before, the dust and scratch passes nibbled their segments away. On 118 prints and conversions this found 35 stamps, 12 of them new, and nothing that wasn't a stamp.
- Protected areas: eyes, mouths and stamps are now fully protected. A speck right beside one no longer takes its edge.
clean --spot X,Y[,R]
Fills a spot that's left, from its surroundings like a dust fill, with no model involved. X,Y are pixels in a copy cleaned with the same options (the crop comes out the same), and R is an optional radius (default 0.4% of the short side). Repeat the flag for more spots; the recipe lists each one and the pixels it filled.
Memory
A 73-megapixel scan, 16-bit and --scratches included, now peaks at about 2.4 GB of memory instead of 3.9 GB, so a frame fits a small machine's memory cap. Full-image filters work in strips, and inpainting works in a window around each group of holes. The two models are loaded one at a time, and the scratch model runs without OpenCV's Winograd convolution, which held another 1.1 GB.
Everything else gives the same output as before, byte for byte. The Winograd change moves the scratch model's probabilities by a few millionths: on a 73 MP frame, about 2,000 of 68 million pixels of --scratches output differ from 0.4.0.
Recipes say what a model filled
A recipe now says exactly what the scratch pass filled in, instead of a yes/no flag. filled_in_by_model names the model, says where it worked, and gives the pixels filled and their share of the picture. Everything outside those pixels is the scan.
Tests on real photographs
The tests now include Sally Ride's 1984 NASA portrait and Grace Hopper's 1984 Navy portrait (both public domain), plus real dust and fibers measured on a scan of blank film. One test is marked as an expected failure: soft, out-of-focus dust on busy patterns, which clean still misses.
Icon
OpenFilmKit has an icon: film spilling out of an open box.
Install or upgrade
brew upgrade aidansiegel/openfilmkit/openfilmkitOpenFilmKit 0.4.0
16-bit processed masters.
convert --tiff
Writes a 16-bit TIFF at full resolution: sRGB with the profile embedded, losslessly compressed, the same file every time for the same input. It keeps the tens of thousands of levels per channel the conversion computes, where a JPEG keeps 256, so skies and shadows don't band when edited. Any --output ending in .tif does the same.
clean on 16-bit TIFFs
clean now cleans these at full depth and writes a 16-bit TIFF (or, with --output something.jpg, a JPEG for the web). It makes every decision on an 8-bit copy, exactly as for a JPEG, and applies color, cropping, straightening, shadows and dust fills at 16 bits; scratch fills and red eye, which replace small regions, are 8-bit precision inside them. A 16-bit file without a color profile is taken for a linear scan master and refused: convert it first.
JPEG and PNG output is unchanged from 0.3.0, byte for byte.
The README's new "Files you get" table sums up the three: the scan master, the processed master and the viewing copy.
Install or upgrade
brew upgrade aidansiegel/openfilmkit/openfilmkitOpenFilmKit 0.3.0
Scratch removal, and much better face detection in clean.
clean --scratches
A second, opt-in pass for what dust removal leaves: scratches, fibers and debris. Microsoft's scratch-detection model from "Bringing Old Photos Back to Life" finds them and MI-GAN, an inpainting model, fills them in. Faces get a lower threshold and extra speck finders; catchlights, the camera's date stamp and the scan edge are protected; thick dark marks are left as scene. Only the damaged spots are filled; because a model draws what goes into them, the pass is off by default, and the copy's recipe notes it, with the models' checksums. --spare-long-lines leaves long straight lines (tile grout, wires) the model can mistake for scratches.
The two models (about 100 MB, both MIT-licensed) download once on first use from the models-1 release and are checked by SHA-256; openfilmkit models --fetch gets them ahead of time. Both run in OpenCV, so nothing else is installed. A 33-megapixel scan takes about two minutes and 2.5 GB of memory.
Faces
clean now finds faces with YuNet, a small detector built into OpenCV, in all four orientations, so sideways frames are covered. On 154 real photos it found 97% of faces, against about a third for the Haar detector it replaces, with far fewer false detections. Dust removal now protects only eyes and mouths, so dust on cheeks and foreheads is cleaned too. Recipes name the detector used.
Install or upgrade
brew upgrade aidansiegel/openfilmkit/openfilmkitModels for clean --scratches (models-1)
Model files that openfilmkit clean --scratches downloads on first use and checks against these SHA-256 values. Both run in OpenCV (cv2.dnn).
| File | Size | SHA-256 | From |
|---|---|---|---|
scratch_detection_512_fp16.onnx |
75 MB | dcf7d8e2ba56ac154a36d8848dd629aa51e06e4da3fd281dced9752e710b9006 |
Microsoft, Bringing Old Photos Back to Life: the official scratch-detection checkpoint (global_checkpoints.zip, checkpoints/detection/FT_Epoch_latest.pt), exported to ONNX for one 512 px tile with float16 weights |
migan_generator_512.onnx |
28 MB | e91485026851c1d5029d95ce3dcb4774df3d93f0b79e10fe3d15b879176d129e |
Picsart AI Research, MI-GAN: the generator taken unchanged out of the authors' migan_pipeline_v2.onnx (Hugging Face), fixed at 512 x 512 |
Both are MIT-licensed by their authors; the license texts are attached (scratch_detection_LICENSE, migan_LICENSE).
tools/build_models.py in the repository rebuilds both files from the authors' originals, byte for byte.
OpenFilmKit 0.2.0
Conversion now works on raw scans from SilverFast and VueScan, and on Windows.
Scans from other software
convert reads the raw scans SilverFast (48-bit HDR, 64-bit HDRi) and VueScan (48-bit raw, 64-bit RGBI raw) save, so a scanner OpenFilmKit can't drive yet, or a Windows PC, still gets the same film-stock conversion and cleanup. Compressed (LZW, ZIP) and uncompressed files, either byte order and planar layouts all work; infrared channels and pages stay in your file and are skipped for now. Save the raw scan before any inversion: see "Scans from SilverFast or VueScan" in the README.
Checked against a real SilverFast 9 HDRi scan from an OpticFilm 8200i. VueScan files follow its documented raw format but haven't been tested with a real file yet.
Windows
pip install "openfilmkit[clean]"convert and clean run on Windows; scanning still needs SANE, so scan with SilverFast or VueScan there. The tests now run on Linux, macOS and Windows with every change.
Also
- New dependencies:
tifffileandimagecodecs(both BSD-licensed). - Your own SANE scans convert exactly as before.
- On Windows,
openfilmkit profiles | moreclosing early no longer prints an error.
Install or upgrade (macOS, Linux)
brew install aidansiegel/openfilmkit/openfilmkitOpenFilmKit 0.1.1
A fix for pip installs, ahead of the first PyPI release.
cleanfailed when pip installed OpenCV 5, which moved the face detector (CascadeClassifier) out of its main package. Thecleanextra now requires OpenCV 4. Homebrew installs pinned OpenCV 4.14 and were not affected.- A pip install (
pip install "openfilmkit[clean]") converts and cleans scans from any software, but scanning needs the SANE runtime the Homebrew formula builds. The README and the missing-runtime message now say so.
Install
brew install aidansiegel/openfilmkit/openfilmkit
openfilmkit doctorNothing else changed since 0.1.0.
OpenFilmKit 0.1.0
First release, early: the kit installs and works end to end, with more to come (scanner color profiling, a terminal UI).
Install
brew install aidansiegel/openfilmkit/openfilmkit
openfilmkit doctorTested on macOS (Apple silicon) and Fedora (aarch64). The formula builds OpenFilmKit's own SANE runtime: upstream commit 8ebb7c50 plus a fix for the Plustek OpticFilm 8200i SE's blue channel (patches/).
What's in it
doctor,scanners,options: check the driver and identify the scanner (driver model ID confirmed against USB descriptors).roll new,scan: capture linear 48-bit TIFF masters, verified after writing, with a record of exactly how each was made.--full-areascans the driver's whole area.stocks,profiles,roll set,convert: negative conversion with 142 film response profiles digitized from manufacturers' data sheets and Columbia's DoRF database.clean: dust and fiber removal, film-holder edge crop, optional color, straightening and red-eye, always on a new copy with a recipe.--jsonon every command.
Known limits
- First scanner: Plustek OpticFilm 8200i SE (SANE status "basic"; no infrared).
- macOS and Linux only.
- See ROADMAP.md.