Inversion of Film Negative Discussion of technique

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
TedBaker
Posts: 50
Joined: 2017-10-10T14:14:55-07:00
Authentication code: 1151

Inversion of Film Negative Discussion of technique

Post by TedBaker »

I have a good understanding of conventional photographic processes, can print color neg, B&W with reasonable skill etc, some limited math (should have paid attention more in class), and some basic understanding of the digital scanning processes. I am attempting to use imagemagick with some additional scripts to provide a better software solution for scanning film (both B&W and color).

I have read a few papers on the topic and my limited knowledge tell me that simply using a function to 'Invert' like negate on its own will not work with a film negative.

Some scanner software have film profiles, which I suspect, is a function using the film base as 'black point' and characteristic curve of the film to the inversion.

I am currently using a script that uses the following algorithm (which I got from a script):


1. Determine the RGB values of the film base, and the RGB of brightest area of series of shots (in similar lighting) from a linear scan of the negative

using -format fx: minima.r maxima.r

2. calculate the following values

a. calculate the value to subtract from each channel using the max and min from red channel

$subtract= (minima.r/maxima.r)^(1/$desired_gamma)*QuantumRange*0.95 [$desired_gamma = 2.15)

b. calculate the extra gamma to be applied to green and blue channel using the following

$extra_gamma_g = log(maxima.g)/minima.g)/log(maxima.r/minima.r)
$extra_gamma_b = log(maxima.b)/minima.b)/log(maxima.r/minima.r)

3. apply those values to image:

convert infile -set colorspace RGB \
-channel R -fx "$min_r/u" \
-channel G -fx "$min_g/u" -gamma $extra_gamma_g \
-channel B -fx "$min_b/u" -gamma $$extra_gamma_b \
+channel -gamma $desired_gamma -evaluate Subtract $subtract \
outfile

This seems to work pretty well as a starting point, and I have my head around most of the math,

So I am opening this up for discussion on:

a. how this compares with other approaches
b. how I might improve it
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Inversion of Film Negative Discussion of technique

Post by fmw42 »

Take a look at my unix bash shell scripts, neg2pos and negative2positive, at my link below.
TedBaker
Posts: 50
Joined: 2017-10-10T14:14:55-07:00
Authentication code: 1151

Re: Inversion of Film Negative Discussion of technique

Post by TedBaker »

fmw42 wrote: 2017-10-19T10:47:00-07:00 Take a look at my unix bash shell scripts, neg2pos and negative2positive, at my link below.
Thanks I did take a look at those, but my understanding of how both those scripts work, is they use the -negate to invert the image, before attempting to make a colour correction, am I correct on that point?

The trouble with using -negate is (or at least my understanding is) that it works by simply subtracting the current value of the pixel from the 'white' value. By doing that you destroy the color fidelity of the image, I was hoping to discuss alternative methods that do not just -negate the negative.

In a way each film stock/paper combination has it's own unique 'colorspace', that needs to taken into account.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Inversion of Film Negative Discussion of technique

Post by fmw42 »

Negative2positive has some code in it to use profiles to change from cmyk to srgb for example rather than just negate. But I have not included the input arguments to provide the profiles. If that is important, I can add those.
Post Reply