Contrast on scanning -- ImageMagick

xwhatsit

Well-known
Local time
12:09 AM
Joined
Feb 3, 2010
Messages
344
Warning: geekery ahead.

I've been doing the hybrid thing; develop negs, then scan. The trouble with scanning negs is the flat contrast.

Up until now, it hasn't been a huge issue. I've been using Maco UP400+ and pushing to 1600, and the resulting large contrast increase means they scan in and look pretty good without needing much tweaking. The limited curves adjustment you can do in Vuescan was easily enough to produce an on-screen image with reasonable contrast.

However, I just shot a couple of rolls of FP4+ at box speed. At first I was really disappointed, it looked so flat! So rather than trying to tweak in Vuescan, I thought I'd fiddle with curves in GIMP.

The issue with this, is the fact that GIMP can only handle 8 bits per channel, and B&W of course only has one channel. So there's no point in scanning to a 16 bit TIFF. This means after fiddling with curves, you quickly end up with a blocky `steppy' image that looks like a GIF from 1994.

I run Linux, so Photoshop is out. I tried Cinepaint, which is an old fork of GIMP that does 16bit channels. This produced good results but the user interface was worse than GIMP and it was pretty slow.

The good news is that ImageMagick does 16 bit channels fine and very quickly. What is even better (for a complete geek like me) is that ImageMagick is a command-line suite. So I can script the automatic contrast increase of an entire roll of film. The operator is -sigmoidal-contrast. So you simply type `convert Scan01.tif -sigmoidal-contrast 10,50% Result01.tif'. Sigmoidal-contrast gives the classic S-shape curve. The 10 in that example is the amount of curve to give it, and the 50% is the mid-point of the curve. The process is a lot faster than applying levels in GIMP on my ancient laptop and you end up with a beautiful smooth 16bit TIFF. This can then be output to a JPEG (or do it on the fly by specifiying Result01.jpg in the above command, it looks at the extension to figure out what format to save it in). JPEG is 8bit per channel of course, but the important bit is that you weren't doing the actual curves in 8bit and getting rounding errors as a result.

ImageMagick is in Ubuntu, and most other Linux distributions. There's binaries available for Windows and Mac too I think.

Check this link for more info: http://www.imagemagick.org/Usage/color/#sigmoidal
 
Last edited:
As a former Linux on the desktop guy who has switched over to OS X (Linux still runs my servers), I use imagemagick all the time, even though I've got an academic copy of CS4 floating around. Sometimes simple, effective and scriptable is best. I've got a handful of bash scripts and Automator actions for dealing with my hybrid workflow.
 
As a former Linux on the desktop guy who has switched over to OS X (Linux still runs my servers), I use imagemagick all the time, even though I've got an academic copy of CS4 floating around. Sometimes simple, effective and scriptable is best. I've got a handful of bash scripts and Automator actions for dealing with my hybrid workflow.

Brian, would you be willing to post and share those scripts? I'd love to see how well Imagemagick works in this capacity. I'm very new to scanning negatives and have not made any decisions about image editing software yet.
 
I won't promise too much -- as how many projects have been started and then given up when the author loses interest -- but last night I started writing the beginnings of a GTK+ app that talks to the MagickWand API to do the image processing.

My idea is that you start it up with a list of fresh-from-the-scanner TIFs, and it opens up each one in turn with some default sigmoidal-contrast values of intensity and mid-point and sharpening. Press the up and down keys to shift the mid-point, left and right to increase/decrease the intensity, and plus/minus to increase/decrease amount of unsharp masking. Press enter, it writes a JPEG copy in another directory or whatever, and shifts onto the next file until it's finished the roll.

Maybe at some point, some flags to specify different film types; all this would change is the default values for contrast/sharpening. I find one roll, as long as I haven't cocked up the exposures too bad (selenium meters in available light can be a bit hit and miss ;)), requires only minor tweaking between one frame to the next.

It would be quite easy to do this with scripts, but I wanted to try talking to ImageMagick via the API and gosh it's nice to be writing C after spending all day at work mired in C++ and ActionScript (bleugh).
 
Last edited:
Back
Top Bottom