Git Product home page Git Product logo

photofinish's Introduction

Photo Finish is a set of command-line tools for automatically processing digital images with a focus on film scans. The eponymous photofinish crops, scales, and converts images in the (presumably) last stage of publishing a photo. I run a "hybrid" work-flow that starts with film scans, but this could also be of use to digital photographers.

A second tool, process_scans converts original TIFF scans into PNG or JP2 (JPEG 2000) files, in a sub-directory, and produces scaled previews. The conversion is useful because most software working with TIFF files does not use any compression. Saving 10~20 MB might not sound like much, but after scanning a whole roll of film (36+ exposures) it quickly adds up. Producing scaled previews and moving the originals to a sub-directory is useful because many programs want to create thumbnails of image files and this can be a very slow process with large, high-resolution scans (e.g ~120 MB each), especially over a network. So use the previews to identify a scan and open the original file manually.

The rest of this page deals primarily with photofinish, although all tools use the same library of classes.

Table of Contents

Description

So what does Photo Finish do?

  1. It decides on the correct cropping window for a specified "destination"
  2. Does the crop and rescaling
  3. Saves the result with custom EXIF/IPTC/XMP metadata

Features

My focus has been on image quality and correctness, so many computations are done in floating-point. The 1990's are long passed, so why limit ourselves to small integers? We have the computational power and memory storage to easily do this the right way.

  • The list of "destinations" is read from a YAML file
    • Destinations describe the size, format, and other specifics of the output
  • Each input file can have its own list of "tags" - EXIF/IPTC/XMP metadata, as well as "variables", some of which override destination parameters
    • This is an artefact of my original shell script (which used exiftool) and expanded in my Perl version (using Image::Exiftool); perhaps this should be replaced by YAML?

Image file formats

  • Reads and writes JPEG, PNG, TIFF, JP2 (JPEG 2000), WebP, JPEG XR (JXR) files
  • Supports having an alpha channel in PNG, TIFF, WebP, JPEG XR files
  • Embedded ICC profiles are used when reading, and created when writing
  • Falls back to sRGB or a similar greyscale profile
  • Reads CMYK image data from JPEG and TIFF files (requires an embedded ICC profile)

Data structures and processing

  • Before rescaling, image pixel data is transformed into the CIE L*a*b* colour space using floating-point components
    • This colour space is perceptually uniform, so it is ideal for rescaling of images
    • Even when the input and output(s) are greyscale, this colour space is used (partly for simplicity, but also because greyscale can have colour to it)
    • Configurable as either single or double precision at compile-time (DP adds almost nothing in my limited tests)
  • Rescaling is done using a Lanczos filter
  • OpenMP is used in several places to take advantage of SMP systems

Current limitations

  • Probably only compiles on Linux for now

Todo

  • Add other image formats e.g RAW formats (reading only)
  • Use YAML (or something else?) for the "tags" format
Crazy idea:
  • An entirely workqueue-based version to keep multiple processors/cores busy at all time

Libraries

Photo Finish currently uses the following libraries:

License

Copyright 2012-2013 Ian Tester <[email protected]>

Photo Finish is licensed under the GNU GPL version 3 or later.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.